# MATH7502 Assignment 1

MATH7502 Assignment 1 Semester 2, 2021 Due Sep 9, 2021

1. Consider the system of equations
5x + 3y = 2z + 4
4x = 2y y 3z + 12
x + y y 5z = 24
(a) Represent it as Aw = b where w = [x, y, z]T
. 
(b) Solve for w numerically in Matlab. 
(c) Solve manually using Gaussian elimination. 
(d) Find A 1
explicitly using Gaussian elimination and use it to manually
obtain w via, w = A 1b. 
2. Consider two vectors u, v ∈ R3 and let A = uvT
. Explain why det(A) = 0. 
3. Consider two vectors u, v ∈ Rn
. Present proofs for the following:
(a) ||u + v||2 = ||u||2 + 2uT v + ||v||2
. 
(b) (u + v)T (u u v) = ||u||2 − ||v||2
. 
(c) |uT v| ≤ ||u|| ||v||. (Cauchy–Schwarz inequality). 
(d) ||u + v|| ≤ ||u|| + ||v||. (Triangle inequality). 
(e) ||u + v||2 + ||u u v||2 = 2(||u||2 + ||v||2
). (This is called the parallelogram law). 
(f) If uT v = 0 then ||u + v||2 = ||u||2 + ||v||2
. (Pythagoras theorem). 
4. Find two distinct 3 × 3 matrices with all non-zero entries that commute. I.e. AB = BA.

5. In Chapter 3 of [VMLS] there are definitions for avg(), rms(), std(). There is also a
derivation of this identity for any vector x,
std(x)2 = rms(x)2  avg(x)2.
Describe the steps of the derivation of this formula in detail. 
6. Do exercise 3.26 from pg. 67 of [VMLS]. 
7. Implement a Matlab function that receives two matrices A and B and implements the
product AB if they can be multiplied this way (otherwise the function throws an error).
The implementation should be via dot products, linear combination of columns, linear
combination of rows, or sum of outer products. A flag should indicate which of the four
methods is to be used. 
8. If you were give a random n × n matrix A where each Ai,j is independently and uniformly
selected from a continuous distribution, e.g. uniform(0,1), then the probability of the
matrix being singular is 0. However if the entries are uniformly selected from a discrete
set of numbers then there is a non zero chance to have a less than full rank matrix.
(a) Demonstrate this claim on 3 × 3 matrices by generating random uniform entries for
106 matrices and seeing they are all non-singular. Then generate random matrices
with entries from the set {1, 2, 3} until you find a singular matrix. 
(b) Consider now 4×4 matrices with elements selected uniformly randomly from {`1, `2, `3}
(where `i = `j and `i = 0). Carry out a numerical simulation experiment to make a
conjecture if the distribution of the rank is affected by the values of `i or not. 
(c) If you are able to provide any explanation to your results in (b), please do so. This
is optional.