<jupyter_start><jupyter_text>Solutions Question 1> `1`. Obtain the determinant and the inverses of the following matrices:> `1`. $A = \begin{pmatrix} 1 / 5 & 1\\1 & 1\end{pmatrix}$<jupyter_code>import sympy as sym

A = sym.Matrix([[sym.S(1) / 5, 1], [1, 1]])
A.det()
A.inv()<jupyter_output><empty_output><jupyter_text>> `2`. $B = \begin{pmatrix} 1 / 5 & 1 & 5\\3 & 1 & 6 \\ 1 & 2 & 1\end{pmatrix}$<jupyter_code>B = sym.Matrix([[sym.S(1) / 5, 1, 5], [3, 1, 6], [1, 2, 1]])
B.det()
B.inv()<jupyter_output><empty_output><jupyter_text>> `3`. $C = \begin{pmatrix} 1 / 5 & 5 & 5\\3 & 1 & 7 \\ a & b & c\end{pmatrix}$<jupyter_code>a, b, c = sym.Symbol("a"), sym.Symbol("b"), sym.Symbol("c")
C = sym.Matrix([[sym.S(1) / 5, 5, 5], [3, 1, 7], [a, b, c]])
C.det()
C.inv()<jupyter_output><empty_output><jupyter_text>Question 2> `2`. Compute the following:> `1`. $500\begin{pmatrix} 1 / 5 & 1\\1 & 1\end{pmatrix}$<jupyter_code>A = 500 * sym.Matrix([[sym.S(1) / 5, 1], [1, 1]])
A<jupyter_output><empty_output><jupyter_text>> `2`. $\pi \begin{pmatrix} 1 / \pi & 2\pi\\3/\pi & 1\end{pmatrix}$<jupyter_code>B = sym.pi * sym.Matrix([[1 / sym.pi, 2 * sym.pi], [3 / sym.pi, 1]])
B<jupyter_output><empty_output><jupyter_text>> `3`. $500\begin{pmatrix} 1 / 5 & 1\\1 & 1\end{pmatrix} + \pi \begin{pmatrix} 1 / \pi & 2\pi\\3/\pi & 1\end{pmatrix}$<jupyter_code>A + B<jupyter_output><empty_output><jupyter_text>> `4`. $500\begin{pmatrix} 1 / 5 & 1\\1 & 1\end{pmatrix}\begin{pmatrix} 1 / \pi & 2\pi\\3/\pi & 1\end{pmatrix}$<jupyter_code>C = sym.Matrix([[1 / sym.pi, 2 * sym.pi], [3 / sym.pi, 1]])
A @ C<jupyter_output><empty_output><jupyter_text>Question 3> `3`. The matrix $A$ is given by $A=\begin{pmatrix}a & 4 & 2\\ 1 & a & 0\\ 1 & 2 & 1\end{pmatrix}$.> `1`. Find the determinant of $A$<jupyter_code>A = sym.Matrix([[a, 4, 2], [1, a, 0], [1, 2, 1]])
determinant = A.det()
determinant<jupyter_output><empty_output><jupyter_text>> `2`. Hence find the values of $a$ for which $A$ is singular.$A$ is singular when the determinant is $0$ so we solve that equation:<jupyter_code>sym.solveset(determinant, a)<jupyter_output><empty_output><jupyter_text>> `3`. State, giving a brief reason in each case, whether the simultaneous equations>> $$  \begin{array}{l}          a x + 4y + 2z= 3a\\          x + a y  = 1\\          x + 2y + z = 3\\  \end{array}  $$> have any solutions when:> `1`. $a = 3$;When $a$ is 3 the determinant is none zero, and so the matrix that representsthat linear system can be inverted.> `2`. $a = 2$When $a$ is 2 the determinant is zero and so the matrix that representsthat linear system cannot be inverted. Question 4> `4`. The matrix $D$ is given by $D = \begin{pmatrix} a & 2 & 0\\ 3 & 1 & 2\\ 0 & -1 & 1\end{pmatrix}$ where $a\ne 2$.> `1`. Find $D^{-1}$.<jupyter_code>D = sym.Matrix([[a, 2, 0], [3, 1, 2], [0, -1, 1]])
D_inverse = D.inv()
D_inverse<jupyter_output><empty_output><jupyter_text>> `2`. Hence of otherwise, solve the equations:>> $$    \begin{array}{l}        a x + 2y = 3\\        3x + y + 2z = 4\\        - y + z = 1\\    \end{array}    $$This corresponds to calculating: $D^{-1} \begin{pmatrix}3\\4\\1\end{pmatrix}$<jupyter_code>b = sym.Matrix([[3], [4], [1]])
D_inverse @ b<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2169723344731116, 'fraction_numerical': 0.05408765930991607, 'mean_word_length': 3.690962099125364, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '434802', 'license': 'MIT', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1332, 'n_words': 357, 'path': 'book/tools-for-mathematics/04-matrices/solutions/.main.md.bcp.ipynb', 'repo_name': '11michalis11/pfm', 'size': '3217'}