{ "cells": [ { "cell_type": "markdown", "id": "39765e0d", "metadata": {}, "source": [ "Question 1 \n", "\n", "For the following matrices find an orthogonal matrix $Q$ which diagonalizes the given matrix. Also check that $Q^TAQ = D$ wjere $D$ is a diagonal matrix.\n", "\n", "(a)$A = \\begin{pmatrix}\n", "1&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix}\\quad$(b)$A = \\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}\\quad$(c)$A = \\begin{pmatrix}\n", "2&1\\\\\n", "1&2\\\\\n", "\\end{pmatrix}\\quad$(d)$A = \\begin{pmatrix}\n", "5&12\\\\\n", "12&-5\\\\\n", "\\end{pmatrix}$" ] }, { "cell_type": "markdown", "id": "a8675f5e", "metadata": {}, "source": [ " Solution (a) \n", "\n", "Eigenvalue; $det(A - \\lambda I) = 0$
\n", "\n", "$\\Rightarrow det\\begin{pmatrix}\n", "1-\\lambda&0\\\\\n", "0&2-\\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (1 - \\lambda)(2 - \\lambda) - 0 = 0$
\n", "$\\Rightarrow 2 - \\lambda - 2\\lambda + \\lambda^2 = 0 $
\n", "$\\Rightarrow \\lambda^2 - 3 \\lambda + 2 = 0$
\n", "$\\Rightarrow (\\lambda - 2) (\\lambda - 1) = 0$\n", "\n", "$\\Rightarrow \\lambda = 2, \\lambda = 1$\n", "\n", "For $\\lambda_{1} = 1$ eigenvector we have $(A - \\lambda I) u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "1-1&0\\\\\n", "0 & 2-1\\\\\n", "\\end{pmatrix}u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "0&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow$ eigenvector $ u = \\begin{pmatrix}\n", "1\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For $\\lambda_{2} = 2$ eigenvector we have $(A - \\lambda I) u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "1-2&0\\\\\n", "0 & 2-2\\\\\n", "\\end{pmatrix}u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-1&0\\\\\n", "0&0\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow$ eigenvector $ u = \\begin{pmatrix}\n", "0\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$ is given by eigenvalues along the leading diagonal. Therefore,
\n", "$D = \\begin{pmatrix}\n", "1&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix}$\n", "\n", "Orthogonal matrix, Q, is given by $Q(u \\quad v)$ if normalized and orthogonal. Therefore,
\n", "$Q = \\begin{pmatrix}\n", "1&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix}$\n", "\n", "Next, $Q^TAQ = \\begin{pmatrix}\n", "1&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "1&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "1&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix} = D$\n", "\n", " Solution (b) \n", "\n", "\n", "Here, eigevalues : $det(A - \\lambda I) =0$\n", "\n", "$\\Rightarrow det\\begin{pmatrix}\n", "1- \\lambda&1\\\\\n", "1 & 1 - \\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (1 - \\lambda)(1 - \\lambda) - 1 = 0$
\n", "$\\Rightarrow (1 - \\lambda)^2 - 1 = 0$
\n", "$\\Rightarrow 1 + \\lambda^2 -2 \\lambda - 1 = 0$
\n", "$\\Rightarrow \\lambda(\\lambda -2) = 0$\n", "\n", "$\\Rightarrow \\lambda = 0$, $\\lambda - 2$\n", "\n", "For$\\lambda_{1} = 0$,\n", "eigenvector can be given by $(A - \\lambda I)u = 0$
\n", "$\\Rightarrow \\begin{pmatrix}\n", "1-0&1\\\\\n", "1&1-0\\\\\n", "\\end{pmatrix}u = 0$
\n", "$\\Rightarrow \\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}\\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$u = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}$\n", "\n", "For eigenvector, when $\\lambda_{2} = 2$\n", "\n", "$\\begin{pmatrix}\n", "1-2&1\\\\\n", "1&1-2\\\\\n", "\\end{pmatrix} u = 0$
\n", "\n", "$\\begin{pmatrix}\n", "-1&1\\\\\n", "1&-1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$
\n", "\n", "$\\Rightarrow v = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "$A$ is symmetric matrix, therefore, eigenvector $u$ and $v$ are orthogonal.\n", "\n", "Next,
\n", "\n", "$\\lVert u \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}\\rVert^2 = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix} = 1^2 + (-1)^2 = 2$\n", "\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{2}$\n", "\n", "$\\Rightarrow \\lVert v \\rVert^2 = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix} = 2$\n", "\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{2}$\n", "\n", "$\\Rightarrow u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow v = \\frac{1}{\\lVert v \\rVert} v = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, our orthogonal matrix, $Q$ is given by:\n", "$ Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix, therfore $Q^T = Q^{-1}$. \n", "\n", "$Q^TAQ = D$ or $QD =AQ$\n", "\n", "$AQ = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "0&2\\\\\n", "0&2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$QD = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "0&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "0&2\\\\\n", "0&2\\\\\n", "\\end{pmatrix}$\n", "\n", " Solution (c) \n", "\n", "Eigenvalue $det(A - \\lambda I) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "2-\\lambda&1\\\\\n", "1&2-\\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (2 - \\lambda)(2 - \\lambda) -1 = 0$
\n", "$\\Rightarrow 4 - 4\\lambda + \\lambda^2 -1 = 0$
\n", "$\\Rightarrow \\lambda^2 - 4\\lambda + 3 = 0$
\n", "$\\Rightarrow \\lambda - \\lambda -3\\lambda + 3 = 0$
\n", "$\\Rightarrow (\\lambda -1)(\\lambda -3) = 0$
\n", "$\\Rightarrow \\lambda_{1} =1$ and $\\lambda_{2} = 3$ \n", "\n", "For eigenvector, when $\\lambda_{1} = 1$
\n", "with $(A - \\lambda I)u = 0$
\n", "$\\Rightarrow \\begin{pmatrix}\n", "2-1&1\\\\\n", "1&2-1\\\\\n", "\\end{pmatrix} \\cdot\\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix}$ \n", "\n", "$x + y = 0$
\n", "$\\Rightarrow x = 1, y = -1$\n", "\n", "Thus, eigenvector, $u = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For eigenvector, when $\\lambda_{1} = 3$
\n", "with $(A - \\lambda I)u = 0$
\n", "$\\Rightarrow \\begin{pmatrix}\n", "2-3&1\\\\\n", "1&2-3\\\\\n", "\\end{pmatrix} \\cdot\\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-1&1\\\\\n", "1&-1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix}$ \n", "\n", "$-x + y = 0$
\n", "$x - y = 0$
\n", "\n", "Thus, eigenvector, $u = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "$A$ is symmetric matrix, therefore, $u$ & $v$ are orthogonal.
\n", "\n", "Now, $\\lVert u \\rVert^2 = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}^2 = 1^2 + (-1)^2 = 2$\n", "\n", "$\\Rightarrow \\rVert u \\lVert = \\sqrt{2}$
\n", "and, $u = \\frac{1}{\\rVert u \\lVert}u = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, $\\lVert v \\rVert^2 = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}^2 = 1^2 + 1^2 = 2$\n", "\n", "$\\Rightarrow \\rVert v \\lVert = \\sqrt{2}$
\n", "and, $u = \\frac{1}{\\rVert v \\lVert}v = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix} $\n", "\n", "Next, our orthogonal matrix, $Q$ is given by $Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$, is given by eigenvalues along the leading diagonal. Therefore, $D = \\begin{pmatrix}\n", "1&0\\\\\n", "0&3\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix therefore, $Q^T = Q^{-1}$\n", "\n", "$\\Rightarrow Q^TAQ = D$
\n", "$\\Rightarrow QD = AQ$
\n", "\n", "Here, $QD = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&0\\\\\n", "0&3\\\\\n", "\\end{pmatrix} = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&3\\\\\n", "-1&3\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow AQ = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "2&1\\\\\n", "1&2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&3\\\\\n", "-1&3\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", " Solution (d) \n", "\n", "Eigenvalue $det(A - \\lambda) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5 - \\lambda&12\\\\\n", "12& -5 - \\lambda\\\\\n", "\\end{pmatrix} = 0$
\n", "\n", "$\\Rightarrow (5 - \\lambda)(-5 - \\lambda) - 12(12) = 0$
\n", "$\\Rightarrow -25 -5 \\lambda + 5\\lambda - 144 = 0$
\n", "$\\Rightarrow \\lambda^2 - 169 = 0$
\n", "$\\Rightarrow \\lambda_{1} = 13$ and $\\lambda_{2} = -13$\n", "\n", "For eigenvector when $\\lambda_{1} = 13$\n", "\n", "$(A - \\lambda I)u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5 - 13&12\\\\\n", "12&-5-13\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-8&12\\\\\n", "12&-18\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -8x + 12y = 0$
\n", "and, $12x - 18y = 0$
\n", "\n", "$\\Rightarrow x = 3, y =2$\n", "\n", "$u = \\begin{pmatrix}\n", "3\\\\\n", "2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For eigenvector when $\\lambda_{2} = -13$\n", "\n", "$(A - \\lambda I)u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5 -(-13)&12\\\\\n", "12&-5-(-13)\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "18&12\\\\\n", "12&8\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 18x + 12y = 0$
\n", "and, $12x + 18y = 0$
\n", "\n", "$\\Rightarrow x = -2, y =3$\n", "\n", "$v = \\begin{pmatrix}\n", "-2\\\\\n", "3\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, $A$ is symmetric, therefore, $u$ and $v$ are orthogonal. \n", "Next,
\n", "\n", "$\\rVert u \\lVert^2 = \\begin{pmatrix}\n", "3\\\\\n", "2\\\\\n", "\\end{pmatrix} = 3^2 + 2^2 = 13$\n", "\n", "$\\Rightarrow \\rVert u \\lVert = \\sqrt{13}$\n", "\n", "$\\Rightarrow u = \\frac{1}{\\rVert u \\lVert} u = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "3\\\\\n", "2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "\n", "$\\rVert v \\lVert^2 = \\begin{pmatrix}\n", "-2\\\\\n", "3\\\\\n", "\\end{pmatrix} = (-2)^2 + 3^2 = 13$\n", "\n", "$\\Rightarrow \\rVert v \\lVert = \\sqrt{13}$\n", "\n", "$\\Rightarrow v = \\frac{1}{\\rVert v \\lVert} v = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "-2\\\\\n", "3\\\\\n", "\\end{pmatrix}$\n", "\n", "With this, orthogonal matrix, $Q$, is given by: \n", "\n", "$Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "3&-2\\\\\n", "2&3\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$ is given by eigenvalues along the leading diagonal. \n", "Then,
\n", "$D = \\begin{pmatrix}\n", "13&0\\\\\n", "0&-13\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix, therfore, $Q^T = A^{-1}$\n", "$\\Rightarrow Q^TAQ = D$ can be written as:
\n", "$QD = AQ$\n", "\n", "Now, $AQ = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "5&12\\\\\n", "12&-5\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "3&-2\\\\\n", "2&3\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "15+24&-10+36\\\\\n", "36-10&-24-15\\\\\n", "\\end{pmatrix}$
$\\qquad= \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "39&26\\\\\n", "26&-39\\\\\n", "\\end{pmatrix}$\n", "\n", "$QD = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "3&-2\\\\\n", "2&3\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "13&0\\\\\n", "0&13\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{13}}\\begin{pmatrix}\n", "39&26\\\\\n", "26&-39\\\\\n", "\\end{pmatrix}$\n", "\n", "Thus, $AQ = QD$" ] }, { "cell_type": "markdown", "id": "c41d13cb", "metadata": {}, "source": [ "----------------- " ] }, { "cell_type": "markdown", "id": "44ca42fe", "metadata": {}, "source": [ " Question 2 \n", "\n", "For the following matrices find an orthogonal matrix $Q$ which diagonalizes the given matrix. Also check that, $Q^TAQ = D$ where $D$ is the diagonal matrix.\n", "\n", "(a)$A = \\begin{pmatrix}\n", "9&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix}\\quad$(b)$A = \\begin{pmatrix}\n", "3&\\sqrt{2}\\\\\n", "\\sqrt{2}&2\\\\\n", "\\end{pmatrix}\\quad$(c)$A = \\begin{pmatrix}\n", "-5&\\sqrt{3}\\\\\n", "\\sqrt{3}&-3\\\\\n", "\\end{pmatrix}\\quad$(d)$A = \\begin{pmatrix}\n", "4&\\sqrt{12}\\\\\n", "\\sqrt{12}&1\\\\\n", "\\end{pmatrix}\\quad$\n" ] }, { "cell_type": "markdown", "id": "077d71b3", "metadata": {}, "source": [ " Solution (a) \n", "\n", "Eigenvalue $det(A - \\lambda) = 0$\n", "\n", "$\\begin{pmatrix}\n", "9 - \\lambda & 3\\\\\n", "3 & 1 - \\lambda \\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (9 - \\lambda)(1 - \\lambda) - 9 = 0$
\n", "$\\Rightarrow 9 -9 \\lambda - \\lambda + \\lambda^2 - 9 = 0$
\n", "$\\Rightarrow \\lambda^2 - 10 \\lambda = 0$
\n", "$\\Rightarrow \\lambda(\\lambda - 10) = 0$
\n", "$\\Rightarrow \\lambda_{1} = 0$ or $\\lambda_{2} = 10$ \n", "\n", "For eigenvector, when $\\lambda_{1} = 0$\n", "\n", "$\\begin{pmatrix}\n", "9-0&3\\\\\n", "3&1-0\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "9&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 9x + 3y = 0$
\n", "and, $3x + 1y = 0$
\n", "\n", "$\\Rightarrow x = -1$ or $y = 3$\n", "\n", "$u = \\begin{pmatrix}\n", "-1\\\\\n", "3\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For eigenvector, when $\\lambda_{2} = 10$\n", "\n", "$\\begin{pmatrix}\n", "9-10&3\\\\\n", "3&1-10\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-1&3\\\\\n", "3&-9\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -x + 3y = 0$
\n", "and, $3x -9y = 0$
\n", "\n", "$\\Rightarrow x = 3$ or $y = 1$\n", "\n", "$v = \\begin{pmatrix}\n", "3\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "Now, $A$ is symmetric therefore $u$ and $v$ are orthogonal\n", "\n", "$\\rVert u \\lVert^2 = \\rVert \\begin{pmatrix}\n", "-1\\\\\n", "3\\\\\n", "\\end{pmatrix} \\lVert^2 = (-1)^2 + 3^2 = 10$\n", "\n", "$\\rVert u \\lVert = \\sqrt{10}$
\n", "\n", "$\\Rightarrow u = \\frac{1}{\\rVert u \\lVert}u = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "-1\\\\\n", "3\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\rVert v \\lVert^2 = \\rVert \\begin{pmatrix}\n", "3\\\\\n", "1\\\\\n", "\\end{pmatrix} \\lVert^2 = 3^2 + 1^2 = 10$\n", "\n", "$\\rVert v \\lVert = \\sqrt{10}$
\n", "\n", "$\\Rightarrow v = \\frac{1}{\\rVert v \\lVert}v = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "3\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "With this, orthogonal matrix, $Q$, is given by:\n", "\n", "$Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "-1&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$, is given by eigenvalues along the leading diagonal. Then,
\n", "$D = \\begin{pmatrix}\n", "0&0\\\\\n", "0&10\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix therefore, $Q^T = Q^{-1}$\n", "\n", "$\\Rightarrow Q^TAQ = D$ can be written as: $QD = AQ$\n", "\n", "Now, $QD = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "-1&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0 &10\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "0&30\\\\\n", "0&10\\\\\n", "\\end{pmatrix}$\n", "\n", "$AQ = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "9&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-1&3\\\\\n", "3&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "-9+9&27+3\\\\\n", "-3+3&9+1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{10}}\\begin{pmatrix}\n", "0&30\\\\\n", "0&10\\\\\n", "\\end{pmatrix}$\n", "\n", "Hence, $QD = AQ$\n", "\n", " Solution (b) \n", "\n", "Eigenvalues $det(A - \\lambda) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "3 - \\lambda& \\sqrt{2}\\\\\n", "\\sqrt{2} & 2 - \\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (3 - \\lambda)(2 - \\lambda) - \\sqrt{2}\\sqrt{2} = 0$
\n", "$\\Rightarrow 6 - 2\\lambda - 3\\lambda + \\lambda^2 - 2 = 0$
\n", "\n", "$\\Rightarrow \\lambda^2 - \\lambda -4 \\lambda + 4 = 0$
\n", "$\\Rightarrow \\lambda(\\lambda -1) - 4(\\lambda -1) = 0$
\n", "$\\Rightarrow (\\lambda -4)(\\lambda - 1) = 0$
\n", "$\\Rightarrow \\lambda = 4$ or $\\lambda = 1$\n", "\n", "For eigenvector, when $\\lambda_{1} = 4$\n", "\n", "$\\Rightarrow (A - \\lambda I)u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "3-4&\\sqrt{2}\\\\\n", "\\sqrt{2}&2-4\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-1&\\sqrt{2}\\\\\n", "\\sqrt{2}&-2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -x + \\sqrt{2}y = 0$
\n", "and, $\\sqrt{2}x - 2y = 0$\n", "\n", "$\\Rightarrow x= 2$ or $y = \\sqrt{2}$\n", "\n", "$\\Rightarrow u = \\begin{pmatrix}\n", "2\\\\\n", "\\sqrt{2}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For eigenvector, when $\\lambda_{2} = 1$\n", "\n", "$\\Rightarrow (A - \\lambda I)u = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "3-1&\\sqrt{2}\\\\\n", "\\sqrt{2}&2-1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "2&\\sqrt{2}\\\\\n", "\\sqrt{2}&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -2x + \\sqrt{2}y = 0$
\n", "and, $\\sqrt{2}x + 1y = 0$\n", "\n", "$\\Rightarrow x= \\sqrt{2}$ or $y = -2$\n", "\n", "$\\Rightarrow v = \\begin{pmatrix}\n", "\\sqrt{2}\\\\\n", "-2\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, $A$ is symmetric, therefore, $u$ and $v$ are orthogonal.
\n", "Next,
\n", "$\\lVert u \\rVert^2 = \\begin{pmatrix}\n", "2\\\\\n", "\\sqrt{2}\\\\\n", "\\end{pmatrix} = 2^2 + (\\sqrt{2})^2 = 6$
\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{6}$
\n", "\n", "$u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "2\\\\\n", "\\sqrt{2}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\begin{pmatrix}\n", "\\sqrt{2}\\\\\n", "-2\\\\\n", "\\end{pmatrix} = \\sqrt{2}^2 + (-2)^2 = 6$
\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{6}$
\n", "\n", "$u = \\frac{1}{\\lVert v \\rVert}v = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "\\sqrt{2}\\\\\n", "-2\\\\\n", "\\end{pmatrix}$\n", "\n", "With this, orthogonal matrix, $Q$, is given by:
\n", "$Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "2&\\sqrt{2}\\\\\n", "\\sqrt{2}&-2\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$ is given eigenvalues along the leading diagonal\n", "\n", "$D = \\begin{pmatrix}\n", "4&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix, therefore, $Q^T = Q^{-1}$\n", "\n", "$\\Rightarrow Q^TAQ = D$ can be written as: $QD = AQ$\n", "\n", "$QD = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "2&\\sqrt{2}\\\\\n", "\\sqrt{2}&-2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "4&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "8&\\sqrt{2}\\\\\n", "4\\sqrt{2}&-2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$AQ = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "3&\\sqrt{2}\\\\\n", "\\sqrt{2}&2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "2&\\sqrt{2}\\\\\n", "\\sqrt{2}&-2\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "6+2 & 3\\sqrt{2} - 2\\sqrt{2}\\\\\n", "2\\sqrt{2} + 2\\sqrt{2} & 2 -4\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "8&\\sqrt{2}\\\\\n", "4\\sqrt{2}&-2\\\\\n", "\\end{pmatrix}$\n", "\n", " Solution (c) \n", "\n", "Eigenvalue: $det(A - \\lambda) = 0$
\n", "$\\Rightarrow \\begin{pmatrix}\n", "-5-\\lambda & \\sqrt{3}\\\\\n", "\\sqrt{3} & -3 - \\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (-5 - \\lambda)(-3 - \\lambda) - \\sqrt{13}\\sqrt{13}$
\n", "\n", "$\\Rightarrow 15 + 5\\lambda + 3\\lambda + \\lambda^2 - 3= 0$
\n", "$\\Rightarrow \\lambda^2 + 8 \\lambda + 12 = 0$
\n", "$\\Rightarrow \\lambda^2 + 6 \\lambda + 2 \\lambda + 12 = 0$
\n", "$\\Rightarrow \\lambda(\\lambda + 6) + 2(\\lambda + 6) = 0$
\n", "$\\Rightarrow \\lambda = -6$ or $\\lambda = -2$\n", "\n", "For eigenvector when $\\lambda_{1} = -6$
\n", "with $(A - \\lambda I)u = 0$\n", "\n", "we get, $\\begin{pmatrix}\n", "-5+6& \\sqrt{3}\\\\\n", "\\sqrt{3}& -3+ 6\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "1&\\sqrt{3}\\\\\n", "\\sqrt{3}&-3\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow x + \\sqrt{3}y = 0$
\n", "and, $\\sqrt{3} + 3y = 0$\n", "\n", "$\\Rightarrow x = -3, y = \\sqrt{3}$\n", "\n", "$u = \\begin{pmatrix}\n", "-3\\\\\n", "\\sqrt{3}\\\\\n", "\\end{pmatrix}$\n", "\n", "For eigenvector when $\\lambda_{1} = -2$
\n", "with $(A - \\lambda I)u = 0$\n", "\n", "we get, $\\begin{pmatrix}\n", "-5+2& \\sqrt{3}\\\\\n", "\\sqrt{3}& -3+ 2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-3&\\sqrt{3}\\\\\n", "\\sqrt{3}&-1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -3x + \\sqrt{3}y = 0$
\n", "and, $\\sqrt{3}x -y = 0$\n", "\n", "$\\Rightarrow x = \\sqrt{3}, y = 3$\n", "\n", "$v = \\begin{pmatrix}\n", "\\sqrt{3}\\\\\n", "-3\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "Now, $A$ is symmetric, therefore, $u$ and $v$ are orthogonal.
\n", "Next,
\n", "$\\lVert u \\rVert^2 = \\begin{pmatrix}\n", "-3\\\\\n", "\\sqrt{3}\\\\\n", "\\end{pmatrix} = (-3)^2 + (\\sqrt{3})^2 = 12$
\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{12}$
\n", "\n", "$u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "-3\\\\\n", "\\sqrt{3}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\begin{pmatrix}\n", "\\sqrt{3}\\\\\n", "3\\\\\n", "\\end{pmatrix} = \\sqrt{3}^2 + (3)^2 = 12$
\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{12}$
\n", "\n", "$u = \\frac{1}{\\lVert v \\rVert}v = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "\\sqrt{3}\\\\\n", "3\\\\\n", "\\end{pmatrix}$\n", "\n", "With this, orthogonal matrix, $Q$, is given by:
\n", "$Q = (\\widehat u \\widehat v) = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "-3&\\sqrt{3}\\\\\n", "\\sqrt{3}&3\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$ is given eigenvalues along the leading diagonal\n", "\n", "$D = \\begin{pmatrix}\n", "-6&0\\\\\n", "0&-2\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix, therefore, $Q^T = Q^{-1}$\n", "\n", "$\\Rightarrow Q^TAQ = D$ can be written as: $QD = AQ$\n", "\n", "$QD = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "-3&\\sqrt{13}\\\\\n", "\\sqrt{13}&3\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-6&0\\\\\n", "0&-2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "18+0 & 0 - 2\\sqrt{3}\\\\\n", "-6\\sqrt{3}+0 & 0 -6\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{12}\\begin{pmatrix}\n", "18&-2\\sqrt{3}\\\\\n", "-6\\sqrt{3}&-6\\\\\n", "\\end{pmatrix}$\n", "\n", "$AQ = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "-5&\\sqrt{13}\\\\\n", "\\sqrt{3}&-3\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-3&\\sqrt{3}\\\\\n", "\\sqrt{3}&3\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{12}}\\begin{pmatrix}\n", "15 +3 & -5\\sqrt{3} + 3\\sqrt{3}\\\\\n", "-3\\sqrt{3} - 3\\sqrt{3}& 3 -9\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{12}\\begin{pmatrix}\n", "18&-2\\sqrt{3}\\\\\n", "-6\\sqrt{3}&-6\\\\\n", "\\end{pmatrix}$\n", "\n", "Solution (d) \n", "\n", "Eigenvalue: $det(A - \\lambda I) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5 - \\lambda & \\sqrt{12}\\\\\n", "\\sqrt{12} & 1 - \\lambda\\\\\n", "\\end{pmatrix} = 0$
\n", "\n", "$\\Rightarrow (5 - \\lambda)(1 - \\lambda) - \\sqrt{12}\\sqrt{12} = 0$
\n", "$\\Rightarrow 5- 5\\lambda - \\lambda + \\lambda^2 - 12 = 0$
\n", "$\\Rightarrow \\lambda^2 - 6\\lambda - 7 = 0$
\n", "$\\Rightarrow \\lambda^2 - 7 \\lambda + \\lambda - 7 =0 $
\n", "$\\Rightarrow (\\lambda + 1)(\\lambda - 7) = 0$\n", "\n", "$\\Rightarrow \\lambda = -1$ or $\\lambda = 7$\n", "\n", "For eigenvector when $\\lambda_{1} = -1$
\n", "with, $(A - \\lambda I)u = 0$
\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5+1 & \\sqrt{12}\\\\\n", "\\sqrt{12} & 2 \\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "6 & \\sqrt{12}\\\\\n", "\\sqrt{12} & 2 \\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 6x + \\sqrt{12}y = 0$
\n", "and, $\\sqrt{12}x + 2y = 0$\n", "\n", "$\\Rightarrow x = -2$ or $y = \\sqrt{12}$\n", "\n", "$u = \\begin{pmatrix}\n", "-2\\\\\n", "\\sqrt{12}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "For eigenvector when $\\lambda_{2} = 7$
\n", "with, $(A - \\lambda I)u = 0$
\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "5-7 & \\sqrt{12}\\\\\n", "\\sqrt{12} & 1-7 \\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-2 & \\sqrt{12}\\\\\n", "\\sqrt{12} & -6 \\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -2x + \\sqrt{12}y = 0$
\n", "and, $\\sqrt{12}x + -6y = 0$\n", "\n", "$\\Rightarrow x = \\sqrt{12}$ or $y = 2$\n", "\n", "$v = \\begin{pmatrix}\n", "\\sqrt{12}\\\\\n", "2\\\\\n", "\\end{pmatrix}$\n", "\n", "Now $A$ is symmetric matrix, therefore, $u$ and $v$ are orthogonal\n", "\n", "$\\lVert u \\rVert^2 = \\begin{pmatrix}\n", "-2\\\\\n", "\\sqrt{12}\\\\\n", "\\end{pmatrix}^2 = (-2)^2 + \\sqrt{12}^2 = 16$
\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{16} = 4$
\n", "\n", "$\\Rightarrow u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{4}\\begin{pmatrix}\n", "-2\\\\\n", "\\sqrt{12}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\begin{pmatrix}\n", "\\sqrt{12}\\\\\n", "2\\\\\n", "\\end{pmatrix}^2 = (\\sqrt{12})^2 + 2^2 = 16$
\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{16} = 4$
\n", "\n", "$\\Rightarrow v = \\frac{1}{\\lVert v \\rVert}v = \\frac{1}{4}\\begin{pmatrix}\n", "\\sqrt{12}\\\\\n", "2\\\\\n", "\\end{pmatrix}$\n", "\n", "With this, orthogonal matrix, $Q$ is given by:\n", "\n", "$Q = (\\widehat u \\widehat v) = \\frac{1}{4}\\begin{pmatrix}\n", "-2& \\sqrt{12}\\\\\n", "\\sqrt{12}& 2\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{2}\\begin{pmatrix}\n", "-1& \\sqrt{3}\\\\\n", "\\sqrt{3}& 1\\\\\n", "\\end{pmatrix}$\n", "\n", "Diagonal matrix, $D$ is given by eigenvalues along the leading diagonal.
\n", "Thus, $D = \\begin{pmatrix}\n", "-1&0\\\\\n", "0&7\\\\\n", "\\end{pmatrix}$\n", "\n", "$Q$ is an orthogonal matrix, therefore $Q^T = Q^{-1}$\n", "\n", "$\\Rightarrow Q^TAQ = D$ can be written as $QD = AQ$\n", "\n", "Here, $QD = \\frac{1}{2}\\begin{pmatrix}\n", "-1& \\sqrt{3}\\\\\n", "\\sqrt{3}& 1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-1&0\\\\\n", "0&7\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{2}\\begin{pmatrix}\n", "1&7\\sqrt{3}\\\\\n", "-\\sqrt{3} & 7\\\\\n", "\\end{pmatrix}$\n", "\n", "$AQ = \\frac{1}{2}\\begin{pmatrix}\n", "5& \\sqrt{12}\\\\\n", "\\sqrt{12}& 1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-1&\\sqrt{3}\\\\\n", "\\sqrt{3}&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$AQ = \\frac{1}{2}\\begin{pmatrix}\n", "5& 2\\sqrt{3}\\\\\n", "2\\sqrt{3}& 1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "-1&\\sqrt{3}\\\\\n", "\\sqrt{3}&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{2}\\begin{pmatrix}\n", "1&7\\sqrt{3}\\\\\n", "-\\sqrt{3} & 7\\\\\n", "\\end{pmatrix}$\n", "\n", "Hence, $QD = AQ$" ] }, { "cell_type": "markdown", "id": "9dae3d5e", "metadata": {}, "source": [ "------------------" ] }, { "cell_type": "markdown", "id": "ad49de05", "metadata": {}, "source": [ "Question 3\n", "\n", "For the following matrices find an orthogonal matrix $Q$ which diagonalizes the given matrix. BY using MATLAB or otherwise check that $Q^TAQ = D$ where $D$ is the diagonal matrix.\n", "\n", "(a)$A = \\begin{pmatrix}\n", "1&0&0\\\\\n", "0&2&0\\\\\n", "0&0&3\\\\\n", "\\end{pmatrix}\\quad$(b)$A = \\begin{pmatrix}\n", "2&2&2\\\\\n", "2&2&2\\\\\n", "2&2&2\\\\\n", "\\end{pmatrix}\\quad$(c)$A = \\begin{pmatrix}\n", "0&0&0\\\\\n", "0&1&1\\\\\n", "0&1&1\\\\\n", "\\end{pmatrix}$" ] }, { "cell_type": "markdown", "id": "24e48aea", "metadata": {}, "source": [ " Solution (a) \n", "\n", "Since, our given matrix, $A = \\begin{pmatrix}\n", "1&0&0\\\\\n", "0&2&0\\\\\n", "0&0&3\\\\\n", "\\end{pmatrix}$ is also a diagonal matrix.\n", "\n", "Then, we need to find an orthogonal matrix, $Q$ such that
$Q^TAQ = A$\n", "\n", "If we take $Q$ equal to identity matrix, $I$, then
\n", "$Q^TAQ = I^TAI$
\n", "$\\qquad = A$\n", "\n", "Thus, we can say identity matrix, $I$ is the orthogonal matrix for $A$\n", "\n", "\n", " Solution (b) \n", "\n", "Eigenvalues: $det(A - \\lambda I) = 0$\n", "\n", "$\\Rightarrow (2 - \\lambda)\\begin{pmatrix}\n", "2-\\lambda&2\\\\\n", "2 & 2 - \\lambda\\\\\n", "\\end{pmatrix} - 2\\begin{pmatrix}\n", "2&2\\\\\n", "2&2-\\lambda\\\\\n", "\\end{pmatrix} + 2\\begin{pmatrix}\n", "2&2-\\lambda\\\\\n", "2&2\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (2 - \\lambda)[(2- \\lambda)(2 - \\lambda) -4] -2[2(2 - \\lambda) -4] + 2[4 - 2(2-\\lambda)] = 0$
\n", "$\\Rightarrow (2 - \\lambda)(4 - 4\\lambda + \\lambda^2 + 4) - 2(4 - 2\\lambda - 4) + 2(4-4 + 2\\lambda) = 0$
\n", "$\\Rightarrow 2\\lambda^2 - 8 \\lambda - \\lambda^3 + 4\\lambda + 8 \\lambda = 0$
\n", "$\\Rightarrow \\lambda^3 - 6\\lambda^2 = 0$
\n", "$\\Rightarrow \\lambda^2 (\\lambda - 6) = 0$
\n", "$\\Rightarrow \\lambda^2 = 0$ and $\\lambda = 6$\n", "\n", "Hence, we can write eigenvalues as $\\lambda_{1} = 0, \\lambda_{2} = 0$ and $\\lambda_{3} = 6$\n", "\n", "For eigenvector when $\\lambda_{1} = 0$,
\n", "with $(A - \\lambda I)u = 0$
\n", "we get,
\n", "\n", "$\\begin{pmatrix}\n", "2-0&2&2\\\\\n", "2&2-0&2\\\\\n", "2&2&2-0\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 2x + 2y + 2z =0$
\n", "and, $2x + 2y + 2z =0$
\n", "and, $2x + 2y + 2z =0$\n", "\n", "This system of equations can have any values for $x, y$ and $z$. Howeverm here we are looking for orthogonal matrix, therefore we need to pick values of $x, y$ and $z$ for eigenvector $u$ and $v$ such that $u \\cdot v = 0$\n", "\n", "For example, if $u = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix}$, and $v = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix}$ we have $u \\cdot v = 0$\n", "\n", "Next, for eigenvector when $\\lambda_{3} = 6$\n", "\n", "we get, $\\begin{pmatrix}\n", "2-6&2&2\\\\\n", "2&2-6&2\\\\\n", "2&2&2-6\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -4x + 2y + 2z = 0$
\n", "and, $2x - 4y + 2z = 0$
\n", "and, $2x + 2y -4z = 0$
\n", "\n", "$\\Rightarrow x = y= z = 1$\n", "\n", "Therefore, third eigenvector $w = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, normalizing eigenvector\n", "\n", "$\\lVert u \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix}^2 \\rVert = 1^2 + (-1)^2 + 0^2 = 2$
\n", "\n", "$ \\lVert u \\rVert = \\sqrt{2}$
\n", "\n", "$\\Rightarrow \\widehat u = \\frac{1}{\\lVert u \\rVert} u = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix}^2 \\rVert = 1^2 + 1^2 + (-2)^2 = 6$
\n", "\n", "$ \\lVert v \\rVert = \\sqrt{6}$
\n", "\n", "$\\Rightarrow \\widehat v = \\frac{1}{\\lVert v \\rVert} v = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert w \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}^2 \\rVert = 1^2 + 1^2 + 1^2 = 3$
\n", "\n", "$ \\lVert w \\rVert = \\sqrt{3}$
\n", "\n", "$\\Rightarrow \\widehat w = \\frac{1}{\\lVert w \\rVert} w = \\frac{1}{\\sqrt{3}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Orthogonal matrix, $Q$ is given by $Q = (\\widehat u \\widehat v \\widehat w)$\n", "\n", "$\\Rightarrow Q = \\begin{pmatrix}\n", "1/\\sqrt{2}& 1/\\sqrt{6} & 1/\\sqrt{3}\\\\\n", "-1/\\sqrt{2}& 1/\\sqrt{6} & 1/\\sqrt{3}\\\\\n", "0& -2/\\sqrt{6} & 1/\\sqrt{3}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "In this case, diagonal matrix, with eigenvalues along the leading diagonal would be :\n", "\n", "$D = \\begin{pmatrix}\n", "0&0&0\\\\\n", "0&0&0\\\\\n", "0&0&6\\\\\n", "\\end{pmatrix}$\n", "\n", "Next using Scipy to get $Q^TAQ$ and check if it's equal to $D$" ] }, { "cell_type": "code", "execution_count": 14, "id": "738c22c7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Resultant matrix of Q^TAQ\n", "[[ 0. 0. 0.]\n", " [ 0. 0. 0.]\n", " [-0. 0. 6.]]\n" ] } ], "source": [ "import numpy as np\n", "\n", "matrix1 = np.array([\n", " [1/np.sqrt(2), 1/np.sqrt(6), 1/np.sqrt(3)],\n", " [-1/np.sqrt(2), 1/np.sqrt(6), 1/np.sqrt(3)],\n", " [0, -2/np.sqrt(6), 1/np.sqrt(3)]\n", "])\n", "\n", "matrix2 = np.array([\n", " [2, 2, 2],\n", " [2, 2, 2],\n", " [2, 2, 2]\n", "])\n", "\n", "matrix3 = np.array([\n", " [1/np.sqrt(2), 1/np.sqrt(6), 1/np.sqrt(3)],\n", " [-1/np.sqrt(2), 1/np.sqrt(6), 1/np.sqrt(3)],\n", " [0, -2/np.sqrt(6), 1/np.sqrt(3)]\n", "])\n", "\n", "result = np.matmul(np.matmul(matrix1.T, matrix2), matrix3)\n", "\n", "# Round the elements to two decimal points\n", "result_rounded = np.round(result, 2)\n", "\n", "print(\"Resultant matrix of Q^TAQ\")\n", "print(result_rounded)\n" ] }, { "cell_type": "markdown", "id": "7c55c7f5", "metadata": {}, "source": [ " Solution (c)\n", "\n", "Eigenvalues: $det(A - \\lambda I) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-\\lambda &0 &0\\\\\n", "0 & 1-\\lambda&1\\\\\n", "0&1&1-\\lambda\\\\\n", "\\end{pmatrix} = 0$
\n", "\n", "$\\Rightarrow -\\lambda[(1-\\lambda)(1-\\lambda) -1] - 0[0(1-\\lambda) - 0(1)] + 0[0(1) -0(1)] = 0$
\n", "\n", "$\\Rightarrow -\\lambda(1 - 2\\lambda + \\lambda^2 -1) = 0$
\n", "$\\Rightarrow -\\lambda^3 + 2\\lambda^2 = 0$
\n", "$\\Rightarrow \\lambda^3 - 2\\lambda^2 = 0$
\n", "$\\Rightarrow \\lambda^2 (\\lambda -2) = 0$
\n", "\n", "$\\Rightarrow \\lambda^2 = 0$ or $\\lambda = 2$\n", "\n", "Here, we can write eigenvalues as $\\lambda_{1} = 0, \\lambda_{2} = 0$ and $\\lambda_{3} =2$\n", "\n", "For eigenvectors when $\\lambda_{1} = 0$
\n", "with $(A - \\lambda I) u = 0$, \n", "\n", "we get,
\n", "$\\begin{pmatrix}\n", "0-0&0&0\\\\\n", "0&1-0&1\\\\\n", "0&1&1-0\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 0x + y + z = 0$
\n", "and, $0x + y + z = 0$\n", "\n", "$\\Rightarrow y = -z$ or $u = \\begin{pmatrix}\n", "0\\\\\n", "-1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "However, we are looking for orthogonal matrix, we need to pick values of $x, y$ and $z$ for $v$ such that $u \\cdot v = 0$ if $v = \\begin{pmatrix}\n", "1\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$ then we have $u \\cdot v = 0$\n", "\n", "Next, for eigenvector when $\\lambda_{3} = 2$, \n", "\n", "we get $\\begin{pmatrix}\n", "0-2&0&0\\\\\n", "0&1-2&1\\\\\n", "0&1&1-2\\\\\n", "\\end{pmatrix} \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -2x = 0$
\n", "and, $-y + z = 0$
\n", "and, $y - z = 0$\n", "\n", "$\\Rightarrow x =0$ and $y =z$ where $y$ and $z$ can be any non-zero\n", "\n", "Therefore, $w = \\begin{pmatrix}\n", "0\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, normalizing eigenvectors\n", "\n", "$\\lVert u \\rVert^2 = \\lVert \\begin{pmatrix}\n", "0\\\\\n", "-1\\\\\n", "1\\\\\n", "\\end{pmatrix} \\rVert^2 = 0^2 + (-1)^2 + 1^2 = 2$\n", "\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{2}$\n", "\n", "$\\Rightarrow \\widehat u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{\\sqrt{2}} \\begin{pmatrix}\n", "0\\\\\n", "-1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\lVert v \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix} \\rVert^2 = 1^2 + 0^2 + 0^2 = 1$\n", "\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{1} = 1$\n", "\n", "$\\Rightarrow \\widehat v = \\frac{1}{\\lVert v \\rVert}v = \\begin{pmatrix}\n", "1\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\lVert w \\rVert^2 = \\lVert \\begin{pmatrix}\n", "0\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix} \\rVert^2 = 0^2 + 1^2 + 1^2 = 2$\n", "\n", "$\\Rightarrow \\lVert w \\rVert = \\sqrt{2}$\n", "\n", "$\\Rightarrow \\widehat w = \\frac{1}{\\lVert w \\rVert}w = \\frac{1}{\\sqrt{2}} \\begin{pmatrix}\n", "0\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Orthogonal matrix, $Q$ is given by $Q = (\\widehat u \\widehat v \\widehat w)$\n", "\n", "Therefore, $Q = \\begin{pmatrix}\n", "0&1&0\\\\\n", "-1/\\sqrt{2}&0&1/\\sqrt{2}\\\\\n", "1/\\sqrt{2}&0&1/\\sqrt{2}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "In this case, diagonal matrix, with eigenvalues along the leading diagonal would be :\n", "\n", "$D = \\begin{pmatrix}\n", "0&0&0\\\\\n", "0&0&0\\\\\n", "0&0&2\\\\\n", "\\end{pmatrix}$\n", "\n", "Next using Scipy to get $Q^TAQ$ and check if it's equal to $D$" ] }, { "cell_type": "code", "execution_count": 15, "id": "32d13699", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Resultant matrix:\n", "[[0. 0. 0.]\n", " [0. 0. 0.]\n", " [0. 0. 2.]]\n" ] } ], "source": [ "import numpy as np\n", "\n", "# Define the matrices\n", "matrix1 = np.array([\n", " [0, 1, 0],\n", " [-1/np.sqrt(2), 0, 1/np.sqrt(2)],\n", " [1/np.sqrt(2), 0, 1/np.sqrt(2)]\n", "])\n", "\n", "matrix2 = np.array([\n", " [0, 0, 0],\n", " [0, 1, 1],\n", " [0, 1, 1]\n", "])\n", "\n", "matrix3 = np.array([\n", " [0, 1, 0],\n", " [-1/np.sqrt(2), 0, 1/np.sqrt(2)],\n", " [1/np.sqrt(2), 0, 1/np.sqrt(2)]\n", "])\n", "\n", "# Perform the matrix multiplications\n", "result = np.matmul(np.matmul(matrix1.T, matrix2), matrix3)\n", "result_rounded = np.round(result, 2)\n", "\n", "print(\"Resultant matrix:\")\n", "print(result_rounded)\n" ] }, { "cell_type": "markdown", "id": "3a76b1cd", "metadata": {}, "source": [ "------------------------------- " ] }, { "cell_type": "markdown", "id": "3bfbac17", "metadata": {}, "source": [ " Question 4 \n", "\n", "For the following matrices find an orthogonal matrix $Q$ which diagonalizes the given matrix. BY using MATLAB or otherwise check that $Q^TAQ = D$.\n", "\n", "(a)$A = \\begin{pmatrix}\n", "1&2&2\\\\\n", "2&1&2\\\\\n", "2&2&1\\\\\n", "\\end{pmatrix}\\quad$(b)$A = \\begin{pmatrix}\n", "2&1&1\\\\\n", "1&2&1\\\\\n", "1&1&2\\\\\n", "\\end{pmatrix}\\quad$(c)$A = \\begin{pmatrix}\n", "-5&4&2\\\\\n", "4&-5&2\\\\\n", "2&2&-8\\\\\n", "\\end{pmatrix}$" ] }, { "cell_type": "markdown", "id": "f09189d2", "metadata": {}, "source": [ "Solution (a) \n", "\n", "Eigenvalue: $det(A - \\lambda I) = 0$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "1-\\lambda& 2 & 2\\\\\n", "2 & 1 - \\lambda & 2\\\\\n", "2 & 2 & 1 - \\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (1- \\lambda)[(1 - \\lambda)(1 - \\lambda) - 2(2)] - 2[2(1- \\lambda) -2(2)] + 2[2(2) - 2(1 - \\lambda)] = 0$
\n", "\n", "$\\Rightarrow (1- \\lambda)[(1 - \\lambda)^2 - 4] -2[2 - 2\\lambda -4] + 2[4 -2 + 2\\lambda] = 0$
\n", "\n", "$\\Rightarrow (1- \\lambda)(1 + \\lambda^2 -2\\lambda - 4) -2(-2\\lambda -2) + 2(2\\lambda + 2) = 0$
\n", "\n", "$\\Rightarrow (1- \\lambda)(\\lambda^2 - 2\\lambda -3) + 4\\lambda + 4 +4\\lambda + 4 = 0$
\n", "\n", "$\\Rightarrow \\lambda^2 - 2\\lambda -3 - \\lambda^3 + 2\\lambda^2 + 3\\lambda + 8\\lambda +8 = 0$
\n", "\n", "$\\Rightarrow -\\lambda^3 + 3\\lambda^2 + 9\\lambda + 5 = 0$
\n", "$\\Rightarrow \\lambda^3 - 3\\lambda^2 - 9\\lambda - 5 = 0$
\n", "\n", "$\\Rightarrow \\lambda^3 -5\\lambda^2 + 2\\lambda^2 + \\lambda - 10\\lambda -5 = 0$\n", "\n", "$\\Rightarrow \\lambda^3 + 2\\lambda^2 + \\lambda -5\\lambda^2 - 10\\lambda -5 = 0$\n", "\n", "$\\Rightarrow \\lambda(\\lambda^2 + 2\\lambda + 1) - 5(\\lambda^2 + 2\\lambda + 1) = 0$\n", "\n", "$\\Rightarrow (\\lambda - 5)(\\lambda^2 + 2\\lambda + 1) =0 $\n", "\n", "$\\Rightarrow (\\lambda - 5)(\\lambda + 1)^2 =0 $\n", "\n", "$\\Rightarrow \\lambda = 5$ and $\\lambda = -1$ with multiplicity of 2.\n", "\n", "Hence, our eigenvalues are $\\lambda_{1} = 5, \\lambda_{2} = -1$ and $\\lambda_{3} = -1$\n", "\n", "Now for eigenvector when $\\lambda = 5$
\n", "with $(A - \\lambda I) u = 0$
\n", "we get, $\\begin{pmatrix}\n", "1-5&2&2\\\\\n", "2&1-5&2\\\\\n", "2&2&1-5\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "-4&2&2\\\\\n", "2&-4&2\\\\\n", "2&2&-4\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow -4x + 2y + 2z = 0$
\n", "and, $2x - 4y + 2z = 0$
\n", "and, $2x + 2y -4z = 0$\n", "\n", "$\\Rightarrow x = y = z = 1$. Thus eigenvector $u = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Next, for eigenvalues when $\\lambda = -1$
\n", "we get, $\\begin{pmatrix}\n", "1-(-1)&2&2\\\\\n", "2&1-(-1)&2\\\\\n", "2&2&1-(-1)\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow \\begin{pmatrix}\n", "2&2&2\\\\\n", "2&2&2\\\\\n", "2&2&2\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "z\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow 2x + 2y + 2z =0$
\n", "and, $2x + 2y + 2z =0$
\n", "and, $2x + 2y + 2z =0$\n", "\n", "This system of equations can have any values for $x, y$ and $z$. Howeverm here we are looking for orthogonal matrix, therefore we need to pick values of $x, y$ and $z$ for eigenvector $v$ and $w$ such that $v \\cdot w = 0$\n", "\n", "For example, if $v = \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix}$, and $w = \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix}$ we have $v \\cdot w = 0$\n", "\n", "Now, normalizing eigenvectors, \n", "\n", "$\\lVert u \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix} \\rVert^2 = 1^2 +1^2 +1^2 = 3$\n", "\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{3}$
\n", "\n", "$\\Rightarrow \\widehat u = \\frac{1}{\\lVert u \\rVert} u = \\frac{1}{\\sqrt{3}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix} \\rVert^2 = 1^2 + (-1)^2 +0^2 = 2$\n", "\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{2}$
\n", "\n", "$\\Rightarrow \\widehat v = \\frac{1}{\\lVert v \\rVert} v = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1\\\\\n", "-1\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert w \\rVert^2 = \\lVert \\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix} \\rVert^2 = 1^2 + 1^2 +2^2 = 6$\n", "\n", "$\\Rightarrow \\lVert w \\rVert = \\sqrt{6}$
\n", "\n", "$\\Rightarrow \\widehat w = \\frac{1}{\\lVert w \\rVert} w = \\frac{1}{\\sqrt{6}}\\begin{pmatrix}\n", "1\\\\\n", "1\\\\\n", "-2\\\\\n", "\\end{pmatrix}$\n", "\n", "Orthogonal matrix, $Q$ is given by $Q = (\\widehat u \\widehat v \\widehat w)$\n", "\n", "Thus, we can write $Q = \\begin{pmatrix}\n", "1/\\sqrt{3}&1/\\sqrt{2}&1/\\sqrt{6}\\\\\n", "1/\\sqrt{3}&-1/\\sqrt{2}&1/\\sqrt{6}\\\\\n", "1/\\sqrt{3}&0&-2/\\sqrt{6}\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "In this case, diagonal matrix, with eigenvalues along the leading diagonal would be :\n", "\n", "$D = \\begin{pmatrix}\n", "5&0&0\\\\\n", "0&-1&0\\\\\n", "0&0&-1\\\\\n", "\\end{pmatrix}$\n", "\n", "Next using Scipy to get $Q^TAQ$ and check if it's equal to $D$" ] }, { "cell_type": "code", "execution_count": 17, "id": "0ca99ea9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Resultant matrix:\n", "[[ 5. 0. -0.]\n", " [ 0. -1. -0.]\n", " [-0. 0. -1.]]\n" ] } ], "source": [ "matrix1 = np.array([\n", " [1/np.sqrt(3), 1/np.sqrt(2), 1/np.sqrt(6)],\n", " [1/np.sqrt(3), -1/np.sqrt(2), 1/np.sqrt(6)],\n", " [1/np.sqrt(3), 0, -2/np.sqrt(6)]\n", "])\n", "\n", "matrix2 = np.array([\n", " [1, 2, 2],\n", " [2, 1, 2],\n", " [2, 2, 1]\n", "])\n", "\n", "matrix3 = np.array([\n", " [1/np.sqrt(3), 1/np.sqrt(2), 1/np.sqrt(6)],\n", " [1/np.sqrt(3), -1/np.sqrt(2), 1/np.sqrt(6)],\n", " [1/np.sqrt(3), 0, -2/np.sqrt(6)]\n", "])\n", "\n", "# Perform the matrix multiplications\n", "result = np.matmul(np.matmul(matrix1.T, matrix2), matrix3)\n", "result_rounded = np.round(result, 2)\n", "\n", "print(\"Resultant matrix:\")\n", "print(result_rounded)" ] }, { "cell_type": "markdown", "id": "bb32a868", "metadata": {}, "source": [ "------------------------ " ] }, { "cell_type": "markdown", "id": "e5192258", "metadata": {}, "source": [ " Question 5 \n", "\n", "Let $A = \\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$. Show that $A^{10} = 2^9A$. Also prove that $A^m = 2^{m-1}A$ where $m$ is a positive integer." ] }, { "cell_type": "markdown", "id": "c409d73a", "metadata": {}, "source": [ " Solution \n", "\n", "In Question 1(b) we already have calculated orthogonal matrix, $Q$ and diagonal matrix, $Q$ for this matrix $A$.\n", "We have,
\n", "\n", "$Q = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}$, and $D = \\begin{pmatrix}\n", "0&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix}$\n", "\n", "We also know that,
\n", "\n", "$A^m = QD^mQ^T$\n", "\n", "Therefore,
\n", "\n", "$A^{10} = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix}^{10} \\cdot \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}^T$\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{2}}\\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&2^{10}\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{2}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot 2^{10} \\begin{pmatrix}\n", "0&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{2^{10}}{2}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = 2^9 \\begin{pmatrix}\n", "0&1\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = 2^9 \\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = 2^9A$\n", "\n", "Hence, proved $A^{10} = 2^9 A$\n", "\n", "Next,
\n", "\n", "$A^m = QD^mQ^T $
\n", "$\\qquad = \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&2\\\\\n", "\\end{pmatrix}^m \\cdot \\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix}^T$\n", "\n", "\n", "$\\qquad = \\frac{1}{\\sqrt{2}}\\frac{1}{\\sqrt{2}}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&2^m\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{1}{2}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot 2^m \\begin{pmatrix}\n", "0&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = \\frac{2^m}{2}\\begin{pmatrix}\n", "1&1\\\\\n", "-1&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "0&0\\\\\n", "0&1\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "1&-1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\qquad = 2^{m-1}\\begin{pmatrix}\n", "1&1\\\\\n", "1&1\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\qquad = 2^{m-1}A$\n", "\n", "Hence, proved $A^m = 2^{m-1}$" ] }, { "cell_type": "markdown", "id": "c791e043", "metadata": {}, "source": [ "----------------------------- " ] }, { "cell_type": "markdown", "id": "226099d5", "metadata": {}, "source": [ " Question 6 \n", "\n", "Show that if $A$ is a diagonal matrix then orthogonal diagonalizing matrix $Q = 1$" ] }, { "cell_type": "markdown", "id": "96acf053", "metadata": {}, "source": [ " Solution \n", "\n", "We have $A$ as diagonal matrix.
\n", "Let's take $Q = I$
\n", "Then,
\n", "$Q^{-1}AQ = I^{-1} AI$
\n", "$\\qquad = IAI$
\n", "$\\qquad = A$\n", "\n", "$\\Rightarrow I$ orthogonally diagonalizes $A$.\n", "\n", "Hence, proved if $A$ is a diagonal matrix, then orthogonally diagonalizing matrix, $Q$ is equal to identity matrix, $I$" ] }, { "cell_type": "markdown", "id": "3a84737a", "metadata": {}, "source": [ "----------------------------- " ] }, { "cell_type": "markdown", "id": "e8385be6", "metadata": {}, "source": [ " Question 7 \n", "\n", "Prove that (a) the zero matrix O and (b) the identity matrix $I$ are orthogonally diagonalizable" ] }, { "cell_type": "markdown", "id": "1ddfd02b", "metadata": {}, "source": [ " Solution (a)\n", "\n", "Lets suppose our zero matrix, O is $3 \\times 3$.\n", "\n", "Then,
\n", "Eigenvalues are $\\lambda_{1} = \\lambda_{2} = \\lambda_{3} = 0$\n", "\n", "Implying, eigenvectors as:\n", "\n", "$u = \\begin{pmatrix}\n", "1\\\\\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}, v = \\begin{pmatrix}\n", "0\\\\\n", "1\\\\\n", "0\\\\\n", "\\end{pmatrix}$, and $w = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "1\\\\\n", "\\end{pmatrix}$\n", "\n", "Normalized values of $u, v, w$ would be the same.\n", "\n", "Therefore now, orthogonal matrix, $Q$ can be given by :\n", "\n", "$Q = (\\widehat u \\widehat v \\widehat w )$\n", "\n", "$\\Rightarrow Q = \\begin{pmatrix}\n", "1&0&0\\\\\n", "0&1&0\\\\\n", "0&0&1\\\\\n", "\\end{pmatrix} = I$\n", "\n", "Then, $Q^{-1}OQ = I^{1}OI = IOI = O$\n", "\n", "Hence, orthogonally diagonalizable.\n", "\n", " Solution (b)\n", "\n", "Since, any identity matrix, $I$ is also a diagonal matrix.\n", "Therefore, from previous solution of question 6, we can state identity matrix is also a diagonalizable matrix, and the orthogonal matrix, $Q = I$" ] }, { "cell_type": "markdown", "id": "fd898e55", "metadata": {}, "source": [ "------------------------- " ] }, { "cell_type": "markdown", "id": "3180eda6", "metadata": {}, "source": [ " Question 8\n", "\n", "Prove that $A = \\begin{pmatrix}\n", "a&b\\\\\n", "b&c\\\\\n", "\\end{pmatrix} \\ne o$ is orthogonally diagonalizable and find the orthogonal matrix $Q$ which diagonalizes the matrix $A$." ] }, { "cell_type": "markdown", "id": "731f56fb", "metadata": {}, "source": [ " Solution \n", "\n", "Here, $A = \\begin{pmatrix}\n", "a&b\\\\\n", "b&c\\\\\n", "\\end{pmatrix} = A^T$\n", "\n", "Therefore, $A$ is a symmetric matrix, thus orthogonally diagonalizable\n", "\n", "Next, Eigenvalues: $det(A - \\lambda) = 0$\n", "\n", "$det\\begin{pmatrix}\n", "a - \\lambda & b\\\\\n", "b & c - \\lambda\\\\\n", "\\end{pmatrix} = 0$\n", "\n", "$\\Rightarrow (a - \\lambda)(c - \\lambda) - b^2 = 0$
\n", "\n", "$\\Rightarrow ac - \\lambda a - c \\lambda + \\lambda^2 + b^2 = 0$
\n", "$\\Rightarrow \\lambda^2 - (a+c)\\lambda + ac - b^2$\n", "\n", "To get eigenvalue $\\lambda$, we can use quadratic equation formula: $x = \\frac{-b + \\sqrt{b^2 - 4ac}}{2a}$\n", "\n", "$\\Rightarrow \\lambda = \\frac{(a+c) \\pm \\sqrt{(a+c)^2 - 4(ac - b)^2}}{2(1)}$
\n", "\n", "$\\qquad = \\frac{(a+c) \\pm \\sqrt{(a^2 + c^2 + 2ac - 4ac + 4b)^2}}{2}$
\n", "\n", "$\\qquad = \\frac{(a+c) \\pm \\sqrt{(a^2 + c^2 -2ac + 4b)^2}}{2}$
\n", "\n", "$\\qquad = \\frac{(a+c) \\pm \\sqrt{(a - c)^2 + 4b^2}}{2}$
\n", "\n", "$\\Rightarrow \\lambda_{1} = \\frac{(a+c) + \\sqrt{(a - c)^2 + 4b^2}}{2}$, and $\\lambda_{2} = \\frac{(a+c) - \\sqrt{(a - c)^2 + 4b^2}}{2}$
\n", "\n", "Next, getting eigenvector for $\\lambda_{1}$ \n", "\n", "with $(A - \\lambda I) u = 0$\n", "\n", "$(A - \\lambda_{1} I) u = \\begin{pmatrix}\n", "a - \\lambda_{1} &b\\\\\n", "b& c - \\lambda_{1}\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow (a - \\lambda_{1})x + by = 0$
\n", "and, $bx + (c - \\lambda_{1})y = 0 $\n", "\n", "$\\Rightarrow x = b$ and $y = \\lambda_{1} -a$\n", "\n", "Therefore, eigenvector $u = \\begin{pmatrix}\n", "b\\\\\n", "\\lambda_{1} - a\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "Next, getting eigenvector for $\\lambda_{2}$ \n", "\n", "with $(A - \\lambda I) u = 0$\n", "\n", "$(A - \\lambda_{2} I) u = \\begin{pmatrix}\n", "a - \\lambda_{2} &b\\\\\n", "b& c - \\lambda_{2}\\\\\n", "\\end{pmatrix} \\cdot \\begin{pmatrix}\n", "x\\\\\n", "y\\\\\n", "\\end{pmatrix} = \\begin{pmatrix}\n", "0\\\\\n", "0\\\\\n", "\\end{pmatrix}$\n", "\n", "$\\Rightarrow (a - \\lambda_{2})x + by = 0$
\n", "and, $bx + (c - \\lambda_{2})y = 0 $\n", "\n", "$\\Rightarrow x = \\lambda_{2} - c$ and $y = b$\n", "\n", "Therefore, eigenvector $v = \\begin{pmatrix}\n", "\\lambda_{2} - c\\\\\n", "b\\\\\n", "\\end{pmatrix}$\n", "\n", "Now, normalizing eigenvectors to get orthogonal matrix\n", "\n", "$\\lVert u \\rVert^2 = \\begin{pmatrix}\n", "b\\\\\n", "\\lambda_{1}- a\\\\\n", "\\end{pmatrix} = b^2 + (\\lambda_{1} - a)^2$\n", "\n", "$\\Rightarrow \\lVert u \\rVert = \\sqrt{b^2 + (\\lambda_{1} - a)^2}$\n", "\n", "$\\widehat u = \\frac{1}{\\lVert u \\rVert}u = \\frac{1}{\\sqrt{b^2 + (\\lambda_{1} - a)^2}}\\begin{pmatrix}\n", "b\\\\\n", "\\lambda_{1}- a\\\\\n", "\\end{pmatrix}$\n", "\n", "\n", "$\\lVert v \\rVert^2 = \\begin{pmatrix}\n", "\\lambda_{2} - c\\\\\n", "b\\\\\n", "\\end{pmatrix} = (\\lambda_{2} - c)^2 + b^2$\n", "\n", "$\\Rightarrow \\lVert v \\rVert = \\sqrt{(\\lambda_{2} - c)^2 + b^2}$\n", "\n", "$\\Rightarrow v = \\frac{1}{\\lVert v \\rVert}v = \\frac{1}{\\sqrt{(\\lambda_{2} - c)^2 + b^2}} \\begin{pmatrix}\n", "\\lambda_{2} -c\\\\\n", "b\\\\\n", "\\end{pmatrix}$\n", "\n", "Orthogonal matrix, $Q$ is given by $Q = (\\widehat u \\widehat v)$\n", "\n", "Therefore, $Q = \\begin{pmatrix}\n", "\\frac{b}{\\sqrt{b^2 + (\\lambda_{1} - a)^2}} & \\frac{\\lambda_{2} - c}{(\\lambda_{2} - c)^2 + b^2}\\\\\n", "\\frac{\\lambda_{1}-a}{\\sqrt{b^2 + (\\lambda_{1} - a)^2}} & \\frac{b}{(\\lambda_{2} - c)^2 + b^2}\\\\\n", "\\end{pmatrix}$" ] }, { "cell_type": "markdown", "id": "1109645d", "metadata": {}, "source": [ "--------------------- " ] }, { "cell_type": "markdown", "id": "ffa42f38", "metadata": {}, "source": [ " Question 9 \n", "\n", "Let $A$ be a symmetric invertible matrix. If $Q$ orthogonally diagonalizes the matrix $A$ show that $Q$ also diagonalizes the matrix $A^{-1}$" ] }, { "cell_type": "markdown", "id": "d30054c4", "metadata": {}, "source": [ " Solution \n", "\n", "We have, $Q$ orthogonally diagonalizing matrix $A$. and we know that a matrix $A$ is orthogonally diagonalizable if is an orthogonal matrix $Q$ such that\n", "\n", "$Q^TAQ = D$ where $D$ is a diagonal matrix\n", "\n", "So, we have
\n", "$D = Q^TAQ$\n", "\n", "Next, taking inverse both side, we have\n", "\n", "$D^{-1} = (Q^TAQ)^{-1}$
\n", "$\\qquad = (Q^T)^{-1}A^{-1}Q^{-1}$
\n", "$\\qquad = (Q^{-1})^{-1}A^{-1}Q^{-1}$
\n", "$\\qquad = QA^{-1}Q^{-1}$
\n", "$\\qquad = QA^{-1}Q^T$
\n", "\n", "We can see that matrix $A^{-1}$ is also diagonalizable by orthogonal matrix, $Q$ where $D^{-1}$ is a diagonal matrix." ] }, { "cell_type": "code", "execution_count": null, "id": "de7fac4f", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.9" } }, "nbformat": 4, "nbformat_minor": 5 }