0% found this document useful (0 votes)
15 views8 pages

MATH4602 Tutorial03-Assigment (1) - Solutions

This document outlines Assignment 1 for the MATH4602 Scientific Computing course at The University of Hong Kong, due on February 17, 2025. It includes various mathematical problems related to matrix theory, determinants, eigenvalues, and computational methods. The assignment requires proofs, computations, and applications of mathematical concepts, including the use of MATLAB for matrix operations.

Uploaded by

457 123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views8 pages

MATH4602 Tutorial03-Assigment (1) - Solutions

This document outlines Assignment 1 for the MATH4602 Scientific Computing course at The University of Hong Kong, due on February 17, 2025. It includes various mathematical problems related to matrix theory, determinants, eigenvalues, and computational methods. The assignment requires proofs, computations, and applications of mathematical concepts, including the use of MATLAB for matrix operations.

Uploaded by

457 123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

AS/4602/WKC/1

THE UNIVERSITY OF HONG KONG


DEPARTMENT OF MATHEMATICS
MATH4602 Scientific Computing
Assignment 1
Due Date: 17 Feb. 2025 (5:00pm)
1. [Basic matrix knowledge] Let Mn be the set of all n × n real matrices. Prove or
disprove the following statements.
(a) Let S ∈ Mn such that AS = SA for all A ∈ Mn then we must have S being the
identity matrix.
(b) Let S ∈ Mn and all the eigenvalues of S are equal to zero. Then S must be the
zero matrix.
2. [Computation of determinant] Consider the following n × n matrix (n = 1, 2, . . . ,):
−1 ···
 
2 0 0
 ... .. 

 −1 2 −1 . 

Cn =
 .. .. .. 
.

 0 . . . 0 
 .. .. 

 . . −1 2 −1 

0 · · · 0 −1 2
(a) Show that det(C1 ) = 2, det(C2 ) = 3 and
det(Cn ) = 2 × det(Cn−1 ) − det(Cn−2 ).
(b)Use Mathematical Induction (M.I.) to prove that det(Cn ) = n + 1.
3. [Partition of a matrix] Let B and C be two n × n matrices such that (B − In ) is
invertible where In is the n × n identity matrix. By using M.I. on k prove that
" #k " #
B C B k (B k − In )(B − In )−1 C
= .
0 In 0 In
Here 0 is the n × n zero matrix.
4. [Inner product] Show that hx, Ayi = hA∗ x, yi where A∗ij = Aji .
5. [Computing the inverse of a matrix via row operations] Compute the inverse of the
following matrix
1 21 13
 

H =  12 31 14 
 
1 1 1
3 4 5
by using elementary row operations and write down all elementary matrices
explicitly.
6. [Computation of eigenvectors and eigenvalues] Find the eigenvalues and associated
eigenvectors of the following matrix A
 
2 −3 6
A =  0 3 −4  .
 

0 2 −3
Did you obtain a set of three linearly independent eigenvectors?

1
7. [Positive definite matrix] Determine the values of a such that the following matrix
A is symmetric positive definite where

a 1 1 1
 
 1 a 1 1 
A= .
 
 1 1 a 1 
1 1 1 a

8. [Forward substitution for lower triangular matrix system] Let


 
1 0 0 0 0
1/2 1 0 0 0
 
 
 
L= 
 1/4 1/2 1 0 0 .


 1/8 1/4 1/2 1 0 

1/16 1/8 1/4 1/2 1

Apply forward substitution to solve the following system of linear equations:

Lx = [1 1 1 1 1]T .

9. [Breakdown in the LU factorization] (a) Conduct the Doolittle’s LU factorization


to the following matrix:  
1 −1 0
A =  −1 1 1  .
 

1 2 1
What did you find?
(b) Interchange the second and the third row of A and re-do the Doolittle’s LU
factorization again. What did you find this time?

10. [LU factorization and computing inverse] (a) Find the Doolittle’s LU factoriza-
tion of  
4 2 1
B= 2 4 2 
.

1 2 4
(b) From (a) obtain the Cholesky factorization of B.
(c) Find the inverse of A by solving the following linear systems:

Bx1 = [1 0 0]T , Bx2 = [0 1 0]T and Bx3 = [0 0 1]T .

11. [Inverse of tensor] Let A and B be two invertible square matrices. Show that

(A ⊗ B)−1 = A−1 ⊗ B −1 .

12. [Eigenvalues of tensor] Let A be an n × n matrix with eigenvalues being contained


in the vector u = [λ1 , . . . , λn ]T and B be a m × m matrix with eigenvalues being
contained in the vector v = [µ1 , . . . , µm ]T . Show that the eigenvalues of A ⊗ B are
contained in the vector u ⊗ v.

2
13. [For-loop and matrix-vector multiplication in MATLAB] To compute the inner prod-
uct of two n×1 vectors x and y, xT y, there are two methods. Try n = 105 , 106 , 107 , 108
and comment on the time for the following two MATLAB programs. Here Tic and
Toc are used to measure the time elapsed.

Program 1 (For-Loop)

x=ones(n,1); y=ones(n,1); w=0;


tic
for i=1:n,
w=w+x(i,1)*y(i,1);
end;
Time=toc

Program 2 (Direct Vector-Vector Multiplication)

x=ones(n,1); y=ones(n,1); w=zeros(n,1);


tic
w=x’*y;
Time=toc

14. [Sherman-Morrison-Woodbury formula] We are given an easy-to-solve linear system


Ax = b where
14 0 0 0
 
 2 14 0 0 
A= 
and b = [1 0 0 0]T .
1 2 14 0
 
 
0 1 2 14

The solution is given by x = [0.0714 − 0.0102 − 0.0036 0.0012]T . Suppose A has


perturbed to Ã, where
15 1 1 1
 
 3 15 1 1 
à =  .

 2 3 15 1 

1 2 3 15
(a) Apply the Sherman-Morrison-Woodbury Formula to obtain the new solution.
(b) Try (a) again if
13 0 0 1
 
 2 14 0 0 
à =  .
 
 1 2 14 0 
−1 1 2 15

3
15. [Strassen’s Algorithm] Let
" # " # " #
A11 A12 B11 B12 C11 C12
A= B= and C =
A21 A22 B21 B22 C21 C22

be three 2 × 2 matrices such that C = A · B. We define

M1 = (A11 + A22 )(B11 + B22 )


M2 = (A21 + A22 )B11
M3 = A11 (B12 − B22 )
M4 = A22 (B21 − B11 )
M5 = (A11 + A12 )B22
M6 = (A21 − A11 )(B11 + B12 )
M7 = (A12 − A22 )(B21 + B22 ).

Show that
" # " #
C11 C12 M1 + M4 − M5 + M7 M3 + M5
C= =
C21 C22 M2 + M4 M1 − M2 + M3 + M6 .

which needs only seven multiplications.

4
1. (a) The statement is false. The matrix S can also"be the#zero matrix.
0 0
(b) The statement is false. One can consider S = . All eigenvalues of S are
1 0
zero but S 6= 0.
2. It is easy to check that det(C1 ) = 2, det(C2 ) = 2 × 2 − 1 = 3. Now
det(Ck ) = 2 × det(Ck−1 ) + det(V )
where V is an (n − 1) × (n − 1) matrix
−1 −1 0
0 0
 

.. .
. ..
 

 0 2 −1 

. .
−1 . . . . 0
 
V = 
 0 .


.. ... ...

. 2 −1
 
 
0 · · · 0 −1 2
We note that det(V ) = − det(Ck−2 ). Hence we have
det(Cn ) = 2 × det(Cn−1 ) − det(Cn−2 ).
(ii) We are going to prove that det(Cn ) = n + 1. Clearly the result is true for n = 1
and 2. Suppose that det(Cn ) = n + 1 then det(Cn+1 ) = 2(n + 1) − n = n + 2.
Hence we have proved the result by the principle of M.I. The result implies that Cn
is non-singular for n = 1, 2, . . . ,.
3. Clearly when k = 1 the equality holds. We assume that
" #k " #
B C B k (B k − In )(B − In )−1 C
= .
0 In 0 In
Then, we have
" #k+1 " #k " # " #" #
B C B C B C B k (B k − In )(B − In )−1 C B C
= = .
0 In 0 In 0 In 0 In 0 In
Since
B k C+(B k −In )(B−In )−1 C = (B k (B−In )+B k −In )(B−In )−1 C = (B k+1 −In )(B−In )−1 C,
we have
" #k+1 " #
B C B k+1 (B k+1 − In )(B − In )−1 C
= .
0 In 0 In
Therefore, by the principle of M.I. we proved the result.
4. n n
A¯ij y¯j
X X
hx, Ayi = xi
i=1 j=1
n Xn
A¯ij xi y¯j
X
=
i=1 j=1
n X n
A¯ij xi y¯j
X
=
i=1 i=1
= hA∗ x, yi.

5
5.
1 1 1 1
    
1 0 0 1 2 3
1 0 0 1 2 3
1 0 0
1  1 1 1 1 1
 −2 1 0   2

3 4
0 1 0 = 0
 
12 12
− 12 1 0 

− 13 0 1 1
3
1
4
1
5
0 0 1 0 1
12
4
45
1
−3 0 1
1 1
− 16
    
1 −6 0 1 2 3
1 0 0 1 0 4 −6 0
1 1 1 1 1
 0 1 0  0
 
12 12
−2 1 0  =  0
 
12 12
− 21 1 0 
1 4
0 −1 1 0 12 45
− 31 0 1 0 0 1
180
1
6
−1 1

− 16
    
1 0 30 1 0 4 −6 0 1 0 0 9 −36 30
1 1

 0 1 −15  0

12 12
− 12 1 0  = 
 0 1
12
0 −3 16 −15 

1 1 1 1
0 0 1 0 0 180 6
−1 1 0 0 180 6
−1 1

    
1 0 0 1 0 0 9 −36 30 1 0 0 9 −36 30
1
 0 12

0  0

12
0 −3 16 −15 
 =  0 1 0 −36 192 −180 
 
1 1
0 0 180 0 0 180 6
−1 1 0 0 1 30 −180 180

6. Let λ be an eigenvalue of A, and v = [v1 v2 v3 ]T be the corresponding eigenvector.


    
2 −3 6 v1 v1
 0 3 −4   v2  = λ  v2 
    


0 2 −3 v3  3
v  
2 − λ −3 6 v1 0
⇐⇒  0

3−λ −4    v2  =  0 
   


0 2 −3 − λ v
3
0
2 − λ −3 6
⇐⇒ det 
 0 3−λ −4   = (λ + 1)(λ − 1)(λ − 2) = 0
0 2 −3 − λ
⇐⇒ λ = −1, 1, or 2.
When λ = −1,     
3 −3 6 v1 0
 0 4 −4   v2  =  0 
    

0 2 −2 v3 0
Then, v(1) = [−1 1 1]T .
When λ = 1,     
1 −3 6 v1 0
 0 2 −4   v2  =  0 
    

0 2 −4 v3 0
Then, v(2) = [0 2 1]T .
When λ = 2,     
3 −3 6 v1 0
 0 4 −4   v2  =  0 
    

0 2 −2 v3 0
Then, v(3) = [1 0 0]T . Yes, the set of eigenvectors {v1 , v2 , v3 } is linearly independent
by checking det([v1 v2 v3 ]) 6= 0.

6
7. Let x = [x1 , x2 , x3 , x4 ], then
xAxT = (a − 1)(x21 + x22 + x23 + x24 ) + (x1 + x2 + x3 + x4 )2 .
Hence, xAxT > 0 for all x 6= [0, 0, 0, 0] if and only if a > 1.
8. We have x1 = 1, and we proceed as follows:
1 − (1/2)x1 = 1/2


 x2 =
x3 = 1 − (1/4)x1 − (1/2)x2 = 1 − 1/2 = 1/2




 x4 = 1 − (1/8)x1 − (1/4)x2 − 1/2x3 = 1 − 1/8 − 1/8 − 1/4 = 1/2
x5 = 1 − (1/16)x1 − (1/8)x2 − (1/4)x3 − (1/2)x4 = 1 − 1/16 − 1/16 − 1/8 − 1/4 = 1/2

9. (a)     
1 −1 0 1 0 0 1 −1 0
A =  −1 1 1  =  −1 1 0   0 U22 U23 
   
.
1 2 1 1 L32 1 0 0 U33
The process breaks down when we are solving for U22 . The value of U22 = 0.
(b) After interchanging the two rows, we have
    
1 −1 0 1 0 0 1 −1 0
à =  1

2 1  =  1 1 0  0 3 1 
  
.
−1 1 1 −1 0 1 0 0 1
The process is smooth.
10. (a) We skip the steps.
   
1 0 0 4 2 1
L =  0.50 1 0 

 and U =  0 3 1.5 

.
0.25 0.5 1 0 0 3
(b) We have
   
1 0 0 4 0 0 1 0.5 0.25
B =  0.50 1 0   0 3 0   0 1 0.5 
   

0.25 0.5 1 0 0 3 0 0 1
or
    
1 0 0 2 √0 0 2 √0 0 1 0.5 0.25
B =  0.50 1 0   0
 
3 √0   0

3 √0   0 1 0.5 

.
0.25 0.5 1 0 0 3 0 0 3 0 0 1

Therefore, B = LLT where


    
1 0 0 2 √0 0 2 √0 0
L =  0.50 1 0   0 3 √0  =  1 3 √0 .
   

0.25 0.5 1 0 0 3 05 0.5 3 3
(c)  
12 −6 0
1 
B −1 = [x1 x2 x3 ] = −6 15 −6 
.
36

0 −6 12

7
11. We have
(A ⊗ B)(A−1 ⊗ B −1 ) = (A · A−1 ) ⊗ (B · B −1 ) = In ⊗ Im = Imn .
Therefore the inverse of (A ⊗ B) is (A−1 ⊗ B −1 ).
12. Let A = P −1 JA P and B = Q−1 JB Q where JA and JB are the Jordan forms of
matrices A and B, respectively. We have
A⊗B = (P −1 JA P )⊗(Q−1 JB Q) = (P −1 ⊗Q−1 )(JA ⊗JB )(P ⊗Q) = (P ⊗Q)−1 (JA ⊗JB )(P ⊗Q)
which means A ⊗ B is similar to (JA ⊗ JB ). Since JA and JB are lower triangular
matrices so is (JA ⊗ JB ). The eigenvalues of (JA ⊗ JB ) can be read from its diagonal
and they are equal to λi µj , (i = 1, . . . , n, j = 1, . . . , m).
13.
n 105 106 107 108
Programme 1 : time in second 3.0 × 10−3 5.3 × 10−3 0.0236 0.2691
Programme 2 : time in second 2.2 × 10−4 9.1 × 10−4 0.0067 0.0483
Program 2 is more efficient than Program 1. We remark that the recorded times
will depend on the computing machine.
14. (a) We note that à = A + [1 1 1 1]T · [1 1 1 1] = uvT . We first check
1 + vT A−1 u = 1 + [1 1 1 1]A−1 [1 1 1 1]T = 1.2491 6= 0.
We can then apply the formula as follows:
Ae−1 b = A−1 b − A−1 u(I + vT A−1 u)−1 vT A−1 b
x̃ = x − (1.2491)−1 · A−1 uvT x
= x − 0.8006 · A−1 u · 0.0588
= x − 0.8006 · 0.0588 · [0.0714 0.0612 0.0576 0.0588]T
= [0.0681 − 0.0131 − 0.0064 − 0.0015]T .

(b) We note that à = A + [1 0 0 1]T · [−1 0 0 1] = uvT . We first check


1 + vT A−1 u = 1 + [−1 0 0 1]A−1 [1 0 0 1]T = 1.0012 6= 0.
We can then apply the formula as follows:
Ae−1 b = A−1 b − A−1 u(I + vT A−1 u)−1 vT A−1 b
x̃ = x − (1.0012)−1 · A−1 uvT x
= [0.0764 − 0.0109 − 0.0039 0.0063]T .

15. It is straight-forward to verify


C11 = A11 B11 + A12 B21 = M1 + M4 − M5 + M7
C12 = A11 B12 + A12 B22 = M3 + M5
C21 = A21 B11 + A22 B21 = M2 + M4
C22 = A21 B12 + A22 B22 = M1 − M2 + M3 + M6 .
The computations of all Mi require only 7 multiplications.

You might also like