Properties of Dot Product - Lab
Introduction
In this lab, you'll be practicing some interesting properties of a dot product-type matrix multiplication. Understanding these properties will become useful as you study machine learning. The lab will require you to calculate results to provide a proof for these properties.
Objectives
In this lab you will:
- Demonstrate the distributive, commutative, and associative property of dot products
- Use the transpose method to transpose Numpy matrices
- Compute the dot product for matrices and vectors
Instructions
- For each property, create suitably sized matrices with random data to prove the equations
- Ensure that size/dimension assumptions are met while performing calculations (you'll see errors otherwise)
- Calculate the LHS and RHS for all equations and show if they are equal or not
Distributive Property - matrix multiplication IS distributive
$A \cdot (B+C) = (A \cdot B + A \cdot C) $
Prove that # Your code here
Associative Property - matrix multiplication IS associative
$A \cdot (B \cdot C) = (A \cdot B) \cdot C $
Prove that # Your code here
Commutative Property - matrix multiplication is NOT commutative
$A \cdot B \neq B \cdot A $
Prove that for matrices, # Your code here
Commutative Property - vector multiplication IS commutative
$x^T \cdot y = y^T \cdot x$
Prove that for vectors, Note: supersciptT denotes the transpose we saw earlier
# Your code here
Simplification of the matrix product
Prove that $ (A \cdot B)^T = B^T \cdot A^T $
# Your code here
Summary
You've seen enough matrix algebra by now to solve a problem of linear equations as you saw earlier. You'll now see how to do this next.