diff --git a/content/notes/math/linear_algebra.mdx b/content/notes/math/linear_algebra.mdx
index 5df25bf..ed0fd4d 100644
--- a/content/notes/math/linear_algebra.mdx
+++ b/content/notes/math/linear_algebra.mdx
@@ -4426,6 +4426,13 @@ If $\mu = pq$, then there is a $\mathbf{v}\in M$ for which $\mathbf{w} = q\mathb
## The module associated with a linear operator
+| $\mathbb{F}[x]$-module $V_\mathrm{T}$ | $\mathbb{F}$-vector space $V$ |
+| --- | --- |
+| Scalar multiplication: $p(x)\mathbf{v}$ | Action of $p(\mathrm{T})$: $p(\mathrm{T})\mathbf{v}$ |
+| Annihilator: $\operatorname{ann}(V_\mathrm{T}) = \Set{p(x)| p(x)V_\mathrm{T} = \Set{0}}$ | Annihilator: $\operatorname{ann}(V) = \Set{p(x) | p(\mathrm{T})(V) = \Set{0}}$ |
+| Monic order $m(x)$ of $V_\mathrm{T}$: $\operatorname{ann}(V_\mathrm{T}) = \langle m(x) \rangle$ | Minimal polynomial of $\mathrm{T}$: $m(x)$ has the smalles degree with $m(\mathrm{T}) = 0$ |
+| Cyclic submodule of $V_\mathrm{T}$: \langle \mathbf{v}\rangle = \Set{p(x)\mathbf{v} | \deg(p(x)) < \deg(m(x))} | $\mathrm{T}$-cyclic subspace of $V$: \langle \mathbf{v}, \mathrm{T}\mathbf{v},\dots, \mathrm{T}^{m-1}(\mathbf{V})\rangle,\; m = \deg(p(x)) |
+
Let $V$ be a finite-dimensional vector space. If $\mathrm{T}\in\mathcal{L}(V)$, we will think of $V$ not only as a vector space over a field $\mathbb{F}$, but also as a module over $\mathbb{F}[x]$ with scalar multiplication defined by
$$
@@ -4582,7 +4589,219 @@ Let $V$ be a finite-dimensional vector space and let $U\subseteq V$. The followi
2. $U$ is a $\mathrm{T}$-cyclic subspace of $V$ with $\dim(U) = n$
-## Eigenvalues and eigenvectors
+## Primary cyclic decomposition
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$.
+1. The *elementary divisors* and *invariant factors* of $\mathrm{T}$ are the monic elementary divisors and invariant factors, respectively, of the module $V_\mathrm{T}$. The multiset of elementary divisors of $\mathrm{T}$ is denoted $\operatorname{ElemDiv}(\mathrm{T})$, and the multiset of invariant factors of $\mathrm{T}$ is denoted $\operatorname{InvFact}(\mathrm{T})$.
+2. The *elementary divisors* and *invariant factors* of a matrix $\mathbf{A}$ are the elementary divisors and invariant factors, respectively, of the multiplication operator $\mathrm{T}_\mathbf{A}$:
+$$
+\begin{align*}
+ \operatorname{ElemDiv}(\mathbf{A}) =& \operatorname{ElemDiv}(\mathrm{T}_\mathbf{A}) \\
+ \operatorname{InvFact}(\mathbf{A}) =& \operatorname{InvFact}(\mathrm{T}_\mathbf{A}) \\
+\end{align*}
+$$
+
+
+
+Let $V$ be a finite-dimensional vector space and let $\mathrm{T}\in\mathcal{L}(V)$ have the minimal polynomial $m_\mathrm{T} (x) = \prod_{i=1}^n p_i^{e_i} (x)$, where the polynomials $PAGES_DIR_ALIAS(x)$ are distinct monic primes.
+1. **Primary decomposition:** The $\mathbb{F}[x]$-module $V_\mathrm{T}$ is the direct sum $V_\mathrm{T} = \bigoplus_{i=1}^n V_{p_i}$, where
+$$
+ V_{p_i} = \frac{m_\mathrm{T}(x)}{p_i^{e_i}(x)}V = \Set{\mathbf{v}\in V | p_i^{e_i}(\mathrm{T})(\mathbf{v}) = 0}
+$$
+is a primary submodule of $V_\mathrm{T}$ of order $p_i^{e_i} (x)$. In vector space terms, $V_{p_i}$ is a $\mathrm{T}$-invariant subspace of $V$ and the minimal polynomial of $\mathrm{T}|_{V_{p_i}}$ is $\min(\mathrm{T}|_{V_{p_i}}) = p_i^{e_i} (x)$.
+2. **Cyclic decomposition:** Each primary summand $V_{p_i}$ can be decomposed into a direct sum $V_{p_i} = \langle \mathrm{v}_{i,1}\oplus\cdots\oplus\langle\mathbf{v}_{i,k_i}\rangle$ of $\mathrm{T}$-cyclic submodules $\langle\mathbf{v}_{i,j}\rangle$ of order $p_i^{e_{i,j}}(x)$ with
+$$
+ e_i = e_{i,1} \geq e_{i_{k_i}}
+$$
+In vector space terms, $\langle\mathbf{v}_{i,j}\rangle$ is a $\mathrm{T}$-cyclic subspace of $V_{p_i}$ and the minimal polynomial of $\mathrm{T}|_{\langle\mathbf{v}_{i,j}\rangle}$ is $\min(\mathrm{T}|_{\langle\mathbf{v}_{i,j}\rangle} = p_i^{e_{i,j}}(x)$.
+3. **Complete decomposition:** This yields the docomposition of $V_\mathrm{T}$ into a direct sum of $\mathrm{T}$-cyclic subspaces
+$$
+ V_\mathrm{T} = (\langle\mathbf{v}_{1,1}\rangle\oplus\cdots\oplus\langle\mathbf{v}_{1,k_1}\rangle)\oplus\cdots\oplus(\langle\mathbf{v}_{n,1}\rangle\oplus\cdots\oplus\langle\mathbf{v}_{n,k_n}\rangle)
+$$
+4. **Elementary divisors and dimensions:** The multiset of elementary divisors $\Set{p_i^{e_{i,j}}}$ is uniquely determined by $\mathrm{T}$. If $\deg(p_i^{e_{i,j}}(x)) = d_{i,j}$, then the $\mathrm{T}$-cyclic subspace $\langle\mathbf{v}_{i,j}\rangle$ has $\mathrm{T}$-cyclic basis
+$$
+ B_{i,j} = (\mathbf{v}_{i,j}, \mathrm{T}\mathbf{v}_{i,j},\dots,\mathrm{T}^{d_{i,j}-1}\mathbf{v}_{i,j})
+$$
+and $\dim(\langle\mathbf{v}_{i,j}\rangle) = \deg(p_i^{e_{i,j}})$. Hence, $\dim(V_{p_i}) = \sum_{j=1}^{k_i} \deg(p_i^{e_{i,j}})$. The basis $R = \bigcup_{i,j} B_{i,j}$ is called the *elementary divisor basis* for $V_\mathrm{T}$.
+
+
+Recall that if $V = A \oplus B$ and if both $A$ and $B$ are $\mathrm{T}$-invariant subspaces of $V$, the pair $(A,B)$ *reduces* $\mathrm{T}$. In module terms, the pair $(A,B)$ reduces $\mathrm{T}$ if $A$ and $B$ are submodules of $V_\mathrm{T}$ and $V_\mathrm{T} = A_\mathrm{T} \oplus B_\mathrm{T}$.
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$ and let $V_\mathrm{T} = A_\mathrm{T} \oplus B_\mathrm{T}$.
+1. The minimal polynomial of $\mathrm{T}$ is
+$$
+ m_\mathrm{T}(x) = \operatorname{lcm}(m_{\mathrm{T}|_A}(x), m_{\mathrm{T}|_B} (x))
+$$
+2. The primary cyclic decomposition of $V_\mathrm{T}$ is the direc sum of the primary cyclic decompositions of $A_\mathrm{T}$ and $B_\mathrm{T}$. That is, if $A_\mathrm{T} = \bigoplus_{i,j} \langle \mathbf{a}_{i,j}\rangle$ and $B_\mathrm{T} = \bigoplus_{i,j} \langle \mathbf{b}_{i,j} \rangle$ are the cyclic decompositions of $A_\mathrm{T}$ and $B_\mathrm{T}$, respectively, then
+$$
+ V_\mathrm{T} = \left( \bigoplus_{i,j}\langle\mathbf{a}_{i,j}\rangle \right)\oplus \left( \bigoplus_{i,j}\langle\mathbf{b}_{i,j}\rangle\right)
+$$
+is the primary cyclic decomposition of $V_\mathrm{T}$.
+3. The elementary divisors of $\mathrm{T}$ are
+$$
+ \operatorname{ElemDiv}(\mathrm{T}) = \operatorname{ElemDiv}(\mathrm{T}|_A) \cup \operatorname{ElemDiv}(\mathrm{T}|_B)
+$$
+where the union is a multiset union, i.e. we kepp all duplicate members.
+
+
+## Characteristic polynomial
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$ be a linear operator. The *characteristic polynomial* $c_\mathrm{T}(x)$ of $\mathrm{T}$ is the product of all the elementary divisors of $\mathrm{T}$
+
+$$
+ c_\mathrm{T}(x) = \prod_{i,j} p_i^{e_{i,j}}(x)
+$$
+
+Hence, $\deg(c_\mathrm{T}(x)) = \dim(V)$. Similarly the *characteristic polynomial* $c_\mathbf{A}(x)$ of a matrix $\mathbf{A}\in\mathcal{M}_n (\mathbb{F})$ is the product of the elementary divisors of $\mathbf{M}$.
+
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$ be a linear operator.
+1. The minimal polynomial of $\mathrm{T}$ divides the characteristic polynomical of $\mathrm{T}$, i.e. $m_\mathrm{T}(x) | c_\mathrm{T}(x)$. Equivalently, $\mathrm{T}$ satisfies its own characterstic polynomial, i.e. $c_\mathrm{T}(\mathrm{T}) = 0$.
+2. The minimal polynomial $m_\mathrm{T} = \prod_{i=1}^n p_i^{e_{i,1}}(x)$ and characteristic polynomial $c_\mathrm{T}(x) = \prod_{i,j} p_i^{e_{i,j}}(x)$ of $\mathrm{T}$ have the same set of prime factors $p_i(x)$ and hence the same set of roots (not counting multiplicity).
+
+
+
+A linear operator $\mathrm{T}\in\mathcal{L}(V)$ is *nonderogatory* if its minimal polynomial is equal to its characteristic polynomal, i.e.
+
+$$
+ m_\mathrm{T}(x) = c_\mathrm{T}(x)
+$$
+
+or equivalently, if
+
+$$
+ \deg(m_\mathrm{T}(x)) = \deg(c_\mathrm{T}(x))
+$$
+
+or if
+
+$$
+ \deg(m_\mathrm{T}(x)) = \dim(V)
+$$
+
+Similar statements hold for matrices.
+
+
+## Cyclic and indecomposable modules
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$ have minimal polynomial $m_\mathrm{T}(x) = \prod_{i=1}^n p_i^{e_i}(x)$, where $p_i(x)$ are distinct monic primes. The following are equivalent:
+1. $V_\mathrm{T}$ is cyclic
+2. $V_\mathrm{T}$ is the direct sum $V_\mathrm{T} = \bigoplus_{i=1}^k \langle\mathbf{v}_i \rangle$
+3. The elementary divisors of $\mathrm{T}$ are
+$$
+ \operatorname{ElemDiv}(\mathrm{T}) = \Set{p_i^{e_i}(x)}_{i=1}^n
+$$
+4. $\mathrm{T}$ is derogatory, i.e. $m_\mathrm{T}(x) = c_\mathrm{T}(x)$.
+
+
+### Indecomposable modules
+
+
+Let $\mathrm{T}\in\mathcal{L}(V)$ be a linear operator and let $p(x)$ be a prime factor of $m_\mathrm{T}(x)$. Then $V_\mathrm{T}$ has a cyclic submodule $W_\mathrm{T}$ of prime order $p(x)$.
+
+
+
+For a module $W_\mathrm{T}$ of prime order $m_\mathrm{T}(x)$, the following are equivalent:
+1. $W_\mathrm{T}$ is cyclic
+2. $W_\mathrm{T}$ is indecomposable
+3. $W_\mathrm{T}$ is irreducible
+4. $\mathrm{T}$ is nonderogatory
+5. $\dim(W_\mathrm{T}) = \deg(p(x))$
+
+
+### Companion matrices
+
+If $\mathrm{T}\in\mathcal{L}(V)$ is a linear operator, we can characterize the cyclic module $V_\mathrm{T}$ via the matrix representation of $\mathrm{T}$. Let $V_\mathrm{T} = \langle\mathbf{v}\rangle$ be a cyclic module with order $m_\mathrm{T}(x) = \left(\sum_{i=0}^{n-1} a_i x^i\right) + x^n$ and ordered $\mathrm{T}$-cyclic basis $B = (\mathbf{v}, \mathrm{T}\mathbf{v},\dots,\mathrm{T}^{n-1}\mathbf{v})$. Then $\mathrm{T}(\mathrm{T}^i\mathbf{v}) = \mathrm{T}^{i+1}\mathbf{v}$ for $0\leq i \leq n-2$ and
+
+$$
+\begin{align*}
+ \mathrm{T}(\mathrm{T}^{n-1}\mathbf{v}) =& \mathrm{T}^n\mathbf{v} \\
+ =& -\left(\sum_{i=0}^{n-1} a_i \mathrm{T}^i \right)\mathbf{v}
+\end{align*}
+$$
+
+and so
+
+$$
+ [\mathrm{T}]_B = \begin{bmatrix}
+ 0 & 0 & \cdots & 0 & -a_0 \\
+ 1 & 0 & \cdots & 0 & -a_1 \\
+ 0 & 1 & \ddots & ~ & \vdots \\
+ \vdots & \vdots & \ddots & 0 & -a_{n-2} \\
+ 0 & 0 & \cdots & 1 & -a_{n-1} \\
+ \end{bmatrix}
+$$
+
+This is known as the *companion matrix* for the polynomial $m_\mathrm{T}(x)$.
+
+
+The *companion matrix* of a monic polynomial
+
+$$
+ p(x) = \left(\sum_{i=1}^{n-1} a_i x^i \right) + x^n
+$$
+
+is the matrix
+
+$$
+ C[p(x)] = \begin{bmatrix}
+ 0 & 0 & \cdots & 0 & -a_0 \\
+ 1 & 0 & \cdots & 0 & -a_1 \\
+ 0 & 1 & \ddots & ~ & \vdots \\
+ \vdots & \vdots & \ddots & 0 & -a_{n-2} \\
+ 0 & 0 & \cdots & 1 & -a_{n-1} \\
+ \end{bmatrix}
+$$
+
+
+
+Let $p(x)\in\mathbb{F}[x]$.
+1. A companion matrix $\mathbf{A} = C[p(x)]$ is nonderogatory; in fact
+$$
+ c_\mathbf{A}(x) = m_\mathbf{A}(x) = p(x)
+$$
+2. $V_\mathrm{T}$ is cyclic if and only if $\mathrm{T}$ can be represented by a companion matrix, in which case the representing basis is $\mathrm{T}$-cyclic.
+
+
+Proof
+
+**(1):** Let $E = (\mathbf{e}_i)_{i=1}^n$ be the standard basis for $\mathbb{F}^n$. Since $\mathbf{e}_i = \mathbf{A}^{i-1} \mathbf{e}_1$ for $i \geq 2$, it follows that for any polynomial $f(x)$
+
+$$
+ f(\mathbf{A}) = 0 \iff f(\mathbf{A})\mathbf{e}_i = 0\;\forall i \iff f(\mathbf{A})\mathbf{e}_1 = 0
+$$
+
+If $p(x) = \left(\sum_{i=0}^{n-1} a_i x^i\right) + x^n$, then
+
+$$
+\begin{align*}
+ p(\mathbf{A})\mathbf{e}_1 =& \sum_{i=0}^{n-1} a_i \mathbf{A}^i\mathbf{e}_1 + \mathbf{A}^n \mathbf{e}_1 \\
+ =& \sum_{i=0}^{n-1} a_i \mathbf{e}_{i+1} - \sum_{i=0}^{n-1} a_i \mathbf{e}_{i+1} = 0
+\end{align*}
+$$
+
+hence $p(\mathbf{A}) = 0$. Also, if $q(x) = \sum_{i=0}^m b_i x^i$ is nonzero and has degree $m < n$, then
+
+$$
+ q(\mathbf{A})\mathbf{e}_1 = \sum_{i=0}^n b_i \mathbf{e}_{i+1} \neq 0
+$$
+
+since $E$ is linearly independent. Hence, $p(x)$ has smallest degree among all polynomials satisfied by $\mathbf{A}$ and so $p(x) = m_\mathbf{A}(x)$. Finally,
+
+$$
+ \deg(m_\mathbf{A}(x)) = \deg(p(x)) = \deg(c_\mathbf{A}(x))
+$$
+
+**(2):** We know that if $V_\mathrm{T}$ with $\mathrm{T}$-cyclic basis $B$, then $[\mathrm{T}]_B = C[p(x)]$. Conversely, if $[\mathrm{T}]_B = C[p(x)]$, then **(1)** implies that $\mathrm{T}$ is nonderogatory. Hence, the previous theorem implies that $V_\mathrm{T}$ is cyclic. It is clear from the form of $C[p(x)]$ that $B$ is a $\mathrm{T}$-cyclic basis for $V$.
+
+
+
+# Eigenvalues and eigenvectors
Let $V$ be a vector space over an algebraically closed field $\mathbb{F}$, which means that every non-constant polynomial has a root in $\mathbb{F}$.
@@ -4609,7 +4828,6 @@ $$
-
# Inner product space
@@ -5167,3 +5385,5 @@ $$
\end{gather*}
$$
+import { polynomialRoot } from "mathjs"
+