|
1846 | 1846 | "**Exercise 7:** If $A$ is an $n \\times n$ invertible matrix, explain why $A^TA$ is also invertible. " |
1847 | 1847 | ] |
1848 | 1848 | }, |
| 1849 | + { |
| 1850 | + "cell_type": "markdown", |
| 1851 | + "id": "e9d5b7d6", |
| 1852 | + "metadata": {}, |
| 1853 | + "source": [ |
| 1854 | + "**Solution:**\n", |
| 1855 | + "\n", |
| 1856 | + "If we assume that the matrix $A$ is invertible, then it has a pivot in each column. This means that the columns of $A$ are linearly independent and that $A$ has a $QR$ factorization.\n", |
| 1857 | + "\n", |
| 1858 | + "So, $ A^TA = (QR)^T(QR)$ = $ R^TQ^TQR = R^T(Q^TQ)R = R^TR $.\n", |
| 1859 | + "\n", |
| 1860 | + "Since $R$ is an upper-triangular matrix with non-zero enteries on the diagonal we can reduce it to the identity matrix $I$ by performing row operations. This means that $R$ is invertible. The matrix $R^T$ is lower triangular with non-zero entries on the diagonal and is invertible for the same reason. Since $A^TA$ is the product of two invertible matrices, it must also be invertible. (*See exercises in [Inverse Matrices](Inverse_Matrices.ipynb).)*" |
| 1861 | + ] |
| 1862 | + }, |
1849 | 1863 | { |
1850 | 1864 | "cell_type": "markdown", |
1851 | 1865 | "id": "71cfd633", |
|
3599 | 3613 | }, |
3600 | 3614 | { |
3601 | 3615 | "cell_type": "code", |
3602 | | - "execution_count": 12, |
3603 | | - "id": "a9b1fa21", |
| 3616 | + "execution_count": 14, |
| 3617 | + "id": "a547e7e3", |
3604 | 3618 | "metadata": {}, |
3605 | 3619 | "outputs": [ |
3606 | 3620 | { |
3607 | 3621 | "name": "stdout", |
3608 | 3622 | "output_type": "stream", |
3609 | 3623 | "text": [ |
3610 | | - "Pivot could not be found in column 2 .\n", |
3611 | | - "Zero entry found in U pivot position 2 .\n", |
3612 | | - "X_cap: \n", |
3613 | | - " [[0.16666667]\n", |
3614 | | - " [0.66666667]\n", |
3615 | | - " [0. ]] \n", |
| 3624 | + "A_aug_red: \n", |
| 3625 | + " [[1. 0. 2. 0.16666667]\n", |
| 3626 | + " [0. 1. 0. 0.66666667]\n", |
| 3627 | + " [0. 0. 0. 0. ]] \n", |
3616 | 3628 | "\n" |
3617 | 3629 | ] |
3618 | 3630 | } |
3619 | 3631 | ], |
3620 | 3632 | "source": [ |
3621 | | - "X_cap = lag.SolveSystem(A, B_cap)\n", |
| 3633 | + "A_aug = np.array([[1,2,2,1.5],[2,1,4,1],[1,2,2,1.5]])\n", |
| 3634 | + "A_aug_red = lag.FullRowReduction(A_aug)\n", |
3622 | 3635 | "\n", |
3623 | | - "print(\"X_cap: \\n\", X_cap, '\\n')" |
| 3636 | + "print(\"A_aug_red: \\n\", A_aug_red, '\\n')" |
3624 | 3637 | ] |
3625 | 3638 | }, |
3626 | 3639 | { |
3627 | 3640 | "cell_type": "markdown", |
3628 | | - "id": "de71d3e3", |
| 3641 | + "id": "b9155d0c", |
3629 | 3642 | "metadata": {}, |
3630 | 3643 | "source": [ |
3631 | | - "There are an infinite number of least square solutions for the given system. One such solution is \n", |
| 3644 | + "Let\n", |
3632 | 3645 | "\n", |
3633 | 3646 | "$$\n", |
3634 | 3647 | "\\begin{equation}\n", |
3635 | | - "\\hat{X} = \\left[\\begin{array}{r} 0.16666667 \\\\0.66666667 \\\\ 0\\end{array}\\right] \n", |
| 3648 | + "\\hat{X} = \\left[\\begin{array}{r} a \\\\b \\\\ c\\end{array}\\right] \n", |
3636 | 3649 | "\\end{equation}\n", |
3637 | | - "$$\n" |
| 3650 | + "$$\n", |
| 3651 | + "\n", |
| 3652 | + "\n", |
| 3653 | + "We can see that $c$ is a free variable. So, let $c=t$ where $t$ is a scalar. Then, $b = 0.67$, $a = 0.167 - 2t$.\n", |
| 3654 | + "\n", |
| 3655 | + "\n", |
| 3656 | + "So, \n", |
| 3657 | + "\n", |
| 3658 | + "\n", |
| 3659 | + "$$\n", |
| 3660 | + "\\begin{equation}\n", |
| 3661 | + "\\hat{X} = \\left[\\begin{array}{r} 0.167-2t \\\\ 0.67 \\\\ t\\end{array}\\right] \n", |
| 3662 | + "= \\left[\\begin{array}{r} 0.167 \\\\ 0.67 \\\\ 0\\end{array}\\right] +t\\left[\\begin{array}{r} -2 \\\\ 0 \\\\ 1\\end{array}\\right]\n", |
| 3663 | + "\\end{equation}\n", |
| 3664 | + "$$\n", |
| 3665 | + "\n", |
| 3666 | + "Hence, we can conclude that there are infintely many solutions for the system $ A\\hat{X} = \\hat{B}$. One possible solution is:\n", |
| 3667 | + "\n", |
| 3668 | + "$$\n", |
| 3669 | + "\\begin{equation}\n", |
| 3670 | + "\\hat{X} = \\left[\\begin{array}{r} 0.167 \\\\ 0.67 \\\\ 0\\end{array}\\right] \n", |
| 3671 | + "\\end{equation}\n", |
| 3672 | + "$$\n", |
| 3673 | + "\n", |
| 3674 | + "when $t=0$." |
3638 | 3675 | ] |
3639 | 3676 | }, |
3640 | 3677 | { |
|
0 commit comments