📗 \(\begin{cases} m_{11} x_{1} + m_{12} x_{2} = b_{1} \\ m_{21} x_{1} + m_{22} x_{2} = b_{2} \\ \end{cases}\) is a system of two equations and two unknowns \(x_{1}\) and \(x_{2}\).
📗 The system can be written in matrix form: \(\begin{bmatrix} m_{11} & m_{12} \\ m_{21} & m_{22} \end{bmatrix} \begin{bmatrix} x_{1} \\ x_{2} \end{bmatrix} = \begin{bmatrix} b_{1} \\ b_{2} \end{bmatrix}\).
📗 The system may have 0, 1, or infinite number of solutions.
➩ \(\begin{bmatrix} 1 & 2 \\ 3 & 6 \end{bmatrix} \begin{bmatrix} x_{1} \\ x_{2} \end{bmatrix} = \begin{bmatrix} 4 \\ 12 \end{bmatrix}\) has infinite number of solutions, \(x = \begin{bmatrix} 4 - 2 t \\ t \end{bmatrix}\) for any real number \(t\).
📗 In general, if \(d = m_{11} m_{22} - m_{12} m_{21} = 0\), then there are either no solution or infinite number of solutions; otherwise, there is a unique solution \(x = \dfrac{1}{d} \begin{bmatrix} m_{22} b_{1} - m_{12} b_{2} \\ m_{11} b_{2} - m_{21} b_{1} \end{bmatrix}\).
📗 The MATLAB command will always output a solution, usually close to infinity if there are none; and only output one if there are infinite number of them.
➩ There will be a warning about the matrix being singular.
📗 [L, U, P] = lu(M) computes the LU decomposition and y = L \ (P * b); x = U \ y also solves \(M x= b\) for \(x\).
📗 In the case \(M x = b\) needs to be solved repeatedly for the same \(M\) but different \(b\)'s, it is faster to find the LU decomposition once and use \(L, U, P\) on different \(b\)'s.
📗 d = decomposition(M, 'lu'); d \ b uses the same LU decomposition approach without the need to remember how to solve for \(x\) given \(L, U, P\).
TopHat Quiz
📗 In a factor input matrix \(M\), row \(i\) column \(j\) represents the amount of material \(i\) required in the production of product \(j\). In an input vector \(b\), row \(i\) represents the amount of material \(i\) available. Given \(M, b\), compute the number of products that can be produced. Define M = [1 2 3; 4 5 6; 7 8 10]; b = [12; 15; 19];.
📗 A square matrix \(M\) is invertible if there exists \(M^{-1}\) such that \(M^{-1} M = I\), and \(M\) is singular if it is not invertible.
➩ If \(M\) is invertible, then the solution to \(M x = b\) is \(x = M^{-1} b\).
➩ inv(M) finds the inverse of a square matrix \(M\).
📗 The determinant of a matrix \(M\), denoted by \(det\left(M\right)\) or \(\left| M \right|\), measures the magnitude of a matrix.
➩ \(det\left(M\right) = 0\) if and only if \(M\) is singular.
➩ When \(det\left(M\right)\) is close to \(0\), \(M\) could be difficult to invert due to numerical errors, and MATLAB issues a warning about the matrix being close to singular.
➩ det(M) find the determinant of a square matrix \(M\).
📗 Matrices that are close to singular are also called ill-conditioned.
➩ The condition number of a matrix \(M\), denoted by \(\kappa\left(M\right)\), measures how much the solution \(x\) changes due to a small error in \(b\).
➩ The larger the condition number, the more sensitive the solution is to the changes in \(b\), which implies that numerical errors are more likely to affect the solution.
➩ If \(M\) is not inveritble, the condition number of \(M\) is infinity.
➩ cond(M) finds the condition number of a matrix \(M\).
Example
📗 Hilbert matrix is an example of an ill-conditioned matrix.
📗 Row \(i\) column \(j\) of a Hilbert matrix is \(H_{ij} = \dfrac{1}{i + j - 1}\).
➩ For example, a \(3\) by \(3\) Hilbert matrix \(\begin{bmatrix} 1 & \dfrac{1}{2} & \dfrac{1}{3} \\ \dfrac{1}{2} & \dfrac{1}{3} & \dfrac{1}{4} \\ \dfrac{1}{3} & \dfrac{1}{4} & \dfrac{1}{4} \end{bmatrix}\) and a \(4\) by \(4\) Hilbert matrix is \(\begin{bmatrix} 1 & \dfrac{1}{2} & \dfrac{1}{3} & \dfrac{1}{4} \\ \dfrac{1}{2} & \dfrac{1}{3} & \dfrac{1}{4} & \dfrac{1}{5} \\ \dfrac{1}{3} & \dfrac{1}{4} & \dfrac{1}{5} & \dfrac{1}{6} \\ \dfrac{1}{4} & \dfrac{1}{5} & \dfrac{1}{6} & \dfrac{1}{6} \end{bmatrix}\).
➩ hilb(n) creates the \(n\) by \(n\) Hilbert matrix.
TopHat Quiz
📗 m = hilb(n); n = m * ones(n, 1); x = m \ b; [min(x) max(x)] for \(n = 5, 25, 100\).
📗 Notes and code adapted from the course taught by Professors Beck Hasti and Michael O'Neill.
📗 You can expand all TopHat Quizzes and Discussions: .
📗 If there is an issue with TopHat during the lectures, please submit your answers on paper (include your Wisc ID and answers) or this Google form Form at the end of the lecture.