Now it is time to put your new-found knowledge to the test through the practice questions on Linear Algebra listed below. The solutions are available at the end of the lesson but try your best to solve these practice questions by yourself.
1. For matrices $A = \begin{bmatrix} 4 & 7 & 3 \\ 3 & 7 & 0 \\ 4 & 6 & 5 \\ \end{bmatrix}$ and $B = \begin{bmatrix} 1 & 2 & 5 \\ 3 & 8 & 3 \\ 0 & 1 & 8 \\ \end{bmatrix}$, find:
a. $A+B$
b. $A-B$
c. $A\cdot B$
d. $A \times B$
e. $B \times A$
2. For matrices $C = \begin{bmatrix} 5 & 1 \\ 0 & 8 \\ \end{bmatrix}$ and $D = \begin{bmatrix} 4 & 1 \\ 8 & 2 \\ \end{bmatrix}$, find where possible:
a. $det(C)$
b. $C^{-1}$
c. $det(D)$
d. $D^{-1}$
If the inverse does not exist, state why.
Solutions
Were you able to solve all of these questions? If not, you might want to refer back to previous lessons. Nonetheless, here are the solutions:
1.a. $A + B = \begin{bmatrix} 5 & 9 & 8 \\ 6 & 15 & 3 \\ 4 & 7 & 13 \\ \end{bmatrix}$
1.b. $A-B = \begin{bmatrix} 3 & 5 & -2 \\ 0 & -1 & -3 \\ 4 & 5 & -3 \\ \end{bmatrix}$
1.c. $A \cdot B = 144$
1.d. $A \times B = \begin{bmatrix} 4 \times 1 + 7 \times 3 + 3 \times 0 & 4 \times 2 + 7 \times 8 + 3 \times 1 & 4 \times 5 + 7 \times 3 + 3 \times 8 \\ 3 \times 1 + 7 \times 3 + 0 \times 0 & 3 \times 2 + 7 \times 8 + 0 \times 1 & 3 \times 5 + 7 \times 3 + 0 \times 8 \\ 4 \times 1 + 6 \times 3 + 5 \times 0 & 4 \times 2 + 6 \times 8 + 5 \times 1 & 4 \times 5 + 6 \times 3 + 5 \times 8 \\ \end{bmatrix}$ $ = \begin{bmatrix} 25 & 67 & 65 \\ 24 & 62 & 36 \\ 22 & 61 & 78 \end{bmatrix}$
1.e . $B \times A = \begin{bmatrix} 1 \times 4 + 2 \times 3 + 5 \times 4 & 1 \times 7 + 2 \times 7 + 5 \times 6 & 1 \times 3 + 2 \times 0 + 5 \times 5 \\ 3 \times 4 + 8 \times 3 + 3 \times 4 & 3 \times 7 + 8 \times 7 + 3 \times 6 & 3 \times 3 + 8 \times 0 + 3 \times 5 \\ 0 \times 4 + 1 \times 3 + 8 \times 4 & 0 \times 7 + 1 \times 7 + 8 \times 6 & 0 \times 3 + 1 \times 0 + 8 \times 5 \\ \end{bmatrix}$ $= \begin{bmatrix} 30 & 51 & 28 \\ 48 & 95 & 24 \\ 35 & 55 & 40 \\\end{bmatrix}$
2.a. $det(C) = 5\times8 – 0 \times 1 = 40$
2.b. $C^{-1} = \dfrac{1}{40}\begin{bmatrix} 8 & -1 \\ 0 & 5 \\ \end{bmatrix}$ $= \begin{bmatrix} \dfrac{1}{5} & -\dfrac{1}{40} \\ 0 & \frac{1}{8} \end{bmatrix}$
2.c. $det(D)= 4 \times 2 – 8 \times 1 = 0 $
2.d. The inverse does not exist as the determinant is zero.
Hope you enjoyed solving those questions and are now more confident of your conceptual knowledge of Linear Algebra moving forward.
End of the Course
With this, we have come to the end of our Linear Algebra for Data Science Mini-Course. We hope that this short course helped you as a stepping stone towards your journey in learning the concept of Linear Algebra and mathematics for Data Science. If you have any questions or feedback, please feel free to let us know in the comment section.
If you have any questions or feedback, feel free to let us know in the comment section.
Also, now that you are able to code in Python, you can enroll in a domain-specific course by going through all of our intermediate and expert courses.
(As a reminder, we are constantly updating our courses. So, make sure that you check in, in the future as well!)
Do you want to learn Python, Data Science, and Machine Learning while getting certified? Here are some best selling Datacamp courses that we recommend you enroll in:
- Introduction to Python (Free Course) - 1,000,000+ students already enrolled!
- Introduction to Data Science in Python- 400,000+ students already enrolled!
- Introduction to TensorFlow for Deep Learning with Python - 90,000+ students already enrolled!
- Data Science and Machine Learning Bootcamp with R - 70,000+ students already enrolled!