mirror of
https://github.com/janishutz/eth-summaries.git
synced 2025-11-25 02:24:23 +00:00
Fix linear algebra folder structure
This commit is contained in:
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
@@ -1,269 +0,0 @@
|
||||
Yes, you're right! The next step is to diagonalize the matrix, which involves calculating the **eigenvalues** and **eigenvectors** of the transformation matrix \( T \). Once you do that, you can express the recurrence as a closed-form formula for \( a_n \).
|
||||
|
||||
Let's break down the steps involved:
|
||||
|
||||
### Step 1: Find the eigenvalues of the matrix
|
||||
|
||||
You want to find the eigenvalues \( \lambda \) of the matrix \( T \):
|
||||
|
||||
\[
|
||||
T = \begin{bmatrix} 2 & 3 \\ 1 & 0 \end{bmatrix}
|
||||
\]
|
||||
|
||||
Eigenvalues are found by solving the characteristic equation:
|
||||
|
||||
\[
|
||||
\text{det}(T - \lambda I) = 0
|
||||
\]
|
||||
|
||||
where \( I \) is the identity matrix. First, compute the determinant of \( T - \lambda I \):
|
||||
|
||||
\[
|
||||
T - \lambda I = \begin{bmatrix} 2 - \lambda & 3 \\ 1 & -\lambda \end{bmatrix}
|
||||
\]
|
||||
|
||||
Now, compute the determinant:
|
||||
|
||||
\[
|
||||
\text{det}(T - \lambda I) = (2 - \lambda)(-\lambda) - (3)(1) = -2\lambda + \lambda^2 - 3
|
||||
\]
|
||||
|
||||
Simplify the equation:
|
||||
|
||||
\[
|
||||
\lambda^2 - 2\lambda - 3 = 0
|
||||
\]
|
||||
|
||||
Now, solve this quadratic equation for \( \lambda \):
|
||||
|
||||
\[
|
||||
\lambda = \frac{-(-2) \pm \sqrt{(-2)^2 - 4(1)(-3)}}{2(1)} = \frac{2 \pm \sqrt{4 + 12}}{2} = \frac{2 \pm \sqrt{16}}{2} = \frac{2 \pm 4}{2}
|
||||
\]
|
||||
|
||||
Thus, the two eigenvalues are:
|
||||
|
||||
\[
|
||||
\lambda_1 = \frac{2 + 4}{2} = 3 \quad \text{and} \quad \lambda_2 = \frac{2 - 4}{2} = -1
|
||||
\]
|
||||
|
||||
### Step 2: Find the eigenvectors
|
||||
|
||||
Now that you have the eigenvalues \( \lambda_1 = 3 \) and \( \lambda_2 = -1 \), you need to find the corresponding eigenvectors.
|
||||
|
||||
#### Eigenvector for \( \lambda_1 = 3 \):
|
||||
|
||||
Solve \( (T - 3I) \mathbf{v} = 0 \), where \( \mathbf{v} \) is the eigenvector corresponding to \( \lambda_1 \).
|
||||
|
||||
\[
|
||||
T - 3I = \begin{bmatrix} 2 - 3 & 3 \\ 1 & -3 \end{bmatrix} = \begin{bmatrix} -1 & 3 \\ 1 & -3 \end{bmatrix}
|
||||
\]
|
||||
|
||||
Now solve the system:
|
||||
|
||||
\[
|
||||
\begin{bmatrix} -1 & 3 \\ 1 & -3 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}
|
||||
\]
|
||||
|
||||
This gives the system:
|
||||
|
||||
\[
|
||||
- v_1 + 3 v_2 = 0
|
||||
\]
|
||||
\[
|
||||
v_1 - 3 v_2 = 0
|
||||
\]
|
||||
|
||||
Both equations are equivalent, so we have:
|
||||
|
||||
\[
|
||||
v_1 = 3 v_2
|
||||
\]
|
||||
|
||||
Thus, the eigenvector corresponding to \( \lambda_1 = 3 \) is:
|
||||
|
||||
\[
|
||||
\mathbf{v}_1 = \begin{bmatrix} 3 \\ 1 \end{bmatrix}
|
||||
\]
|
||||
|
||||
#### Eigenvector for \( \lambda_2 = -1 \):
|
||||
|
||||
Solve \( (T + I) \mathbf{v} = 0 \), where \( \mathbf{v} \) is the eigenvector corresponding to \( \lambda_2 \).
|
||||
|
||||
\[
|
||||
T + I = \begin{bmatrix} 2 + 1 & 3 \\ 1 & 0 + 1 \end{bmatrix} = \begin{bmatrix} 3 & 3 \\ 1 & 1 \end{bmatrix}
|
||||
\]
|
||||
|
||||
Now solve the system:
|
||||
|
||||
\[
|
||||
\begin{bmatrix} 3 & 3 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} v_1 \\ v_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}
|
||||
\]
|
||||
|
||||
This gives the system:
|
||||
|
||||
\[
|
||||
3 v_1 + 3 v_2 = 0
|
||||
\]
|
||||
\[
|
||||
v_1 + v_2 = 0
|
||||
\]
|
||||
|
||||
From the second equation, we have \( v_1 = -v_2 \). So, the eigenvector corresponding to \( \lambda_2 = -1 \) is:
|
||||
|
||||
\[
|
||||
\mathbf{v}_2 = \begin{bmatrix} -1 \\ 1 \end{bmatrix}
|
||||
\]
|
||||
|
||||
### Step 3: Diagonalize the matrix
|
||||
|
||||
Now that we have the eigenvalues and eigenvectors, we can diagonalize the matrix \( T \).
|
||||
|
||||
Let \( P \) be the matrix formed by the eigenvectors as columns:
|
||||
|
||||
\[
|
||||
P = \begin{bmatrix} 3 & -1 \\ 1 & 1 \end{bmatrix}
|
||||
\]
|
||||
|
||||
The inverse of \( P \) is computed as follows (using the formula for the inverse of a 2x2 matrix):
|
||||
|
||||
\[
|
||||
P^{-1} = \frac{1}{\text{det}(P)} \begin{bmatrix} 1 & 1 \\ -1 & 3 \end{bmatrix}
|
||||
\]
|
||||
|
||||
where \( \text{det}(P) = (3)(1) - (-1)(1) = 3 + 1 = 4 \), so:
|
||||
|
||||
\[
|
||||
P^{-1} = \frac{1}{4} \begin{bmatrix} 1 & 1 \\ -1 & 3 \end{bmatrix}
|
||||
\]
|
||||
|
||||
The diagonal matrix \( D \) will have the eigenvalues on the diagonal:
|
||||
|
||||
\[
|
||||
D = \begin{bmatrix} 3 & 0 \\ 0 & -1 \end{bmatrix}
|
||||
\]
|
||||
|
||||
Thus, \( T \) can be written as:
|
||||
|
||||
\[
|
||||
T = P D P^{-1}
|
||||
\]
|
||||
|
||||
### Step 4: Express the closed-form solution
|
||||
|
||||
Now, to compute \( a_n \), we can use the diagonalization of \( T \):
|
||||
|
||||
\[
|
||||
\mathbf{v}_n = T^{n-1} \mathbf{v}_1 = P D^{n-1} P^{-1} \mathbf{v}_1
|
||||
\]
|
||||
|
||||
The term \( D^{n-1} \) is easy to compute because \( D \) is diagonal:
|
||||
|
||||
\[
|
||||
D^{n-1} = \begin{bmatrix} 3^{n-1} & 0 \\ 0 & (-1)^{n-1} \end{bmatrix}
|
||||
\]
|
||||
|
||||
Thus, the closed-form formula for \( a_n \) is obtained by applying the matrix multiplication:
|
||||
|
||||
\[
|
||||
\mathbf{v}_n = P \begin{bmatrix} 3^{n-1} & 0 \\ 0 & (-1)^{n-1} \end{bmatrix} P^{-1} \mathbf{v}_1
|
||||
\]
|
||||
|
||||
By carrying out these matrix multiplications (which can be done step by step), you'll arrive at a direct formula for \( a_n \), which is a linear combination of the terms involving powers of \( 3 \) and \( (-1)^{n-1} \).
|
||||
|
||||
To rewrite the closed-form solution for \( a_n \) without using vectors or matrices, we need to compute the expression directly in terms of \( n \) and use the properties of the eigenvalues and eigenvectors.
|
||||
|
||||
Let's break down the steps to arrive at a direct formula for \( a_n \).
|
||||
|
||||
### Step 1: General Formula Structure
|
||||
|
||||
From the diagonalization of the matrix \( T \), we have:
|
||||
|
||||
\[
|
||||
\mathbf{v}_n = P D^{n-1} P^{-1} \mathbf{v}_1
|
||||
\]
|
||||
|
||||
where \( P = \begin{bmatrix} 3 & -1 \\ 1 & 1 \end{bmatrix} \), \( D = \begin{bmatrix} 3 & 0 \\ 0 & -1 \end{bmatrix} \), and \( \mathbf{v}_1 = \begin{bmatrix} a_1 \\ a_0 \end{bmatrix} \).
|
||||
|
||||
After performing the matrix multiplication and solving for the values of \( a_n \), we can arrive at a **direct expression** for \( a_n \).
|
||||
|
||||
### Step 2: Compute \( a_n \) in Terms of Eigenvalues
|
||||
|
||||
Since \( T^{n-1} \) is diagonalizable, we know that \( D^{n-1} \) is simply:
|
||||
|
||||
\[
|
||||
D^{n-1} = \begin{bmatrix} 3^{n-1} & 0 \\ 0 & (-1)^{n-1} \end{bmatrix}
|
||||
\]
|
||||
|
||||
Now, we need to express the evolution of the state vector without matrices. The formula for \( a_n \) will be a combination of the eigenvalues \( \lambda_1 = 3 \) and \( \lambda_2 = -1 \), weighted by the initial values \( a_1 \) and \( a_0 \).
|
||||
|
||||
To get the value of \( a_n \), we need to express the result of \( P^{-1} \mathbf{v}_1 \) in a way that we can compute directly.
|
||||
|
||||
### Step 3: Use the Initial Conditions
|
||||
|
||||
The initial conditions give us the starting values of \( a_1 \) and \( a_0 \), and we use the fact that the matrix multiplication \( P D^{n-1} P^{-1} \mathbf{v}_1 \) essentially results in the following:
|
||||
|
||||
\[
|
||||
a_n = \alpha_1 3^{n-1} + \alpha_2 (-1)^{n-1}
|
||||
\]
|
||||
|
||||
where \( \alpha_1 \) and \( \alpha_2 \) are constants determined by the initial conditions. Let's compute these coefficients using \( \mathbf{v}_1 = \begin{bmatrix} a_1 \\ a_0 \end{bmatrix} \).
|
||||
|
||||
### Step 4: Solve for the Coefficients \( \alpha_1 \) and \( \alpha_2 \)
|
||||
|
||||
We know that \( \mathbf{v}_n = P D^{n-1} P^{-1} \mathbf{v}_1 \), and we can solve this system by applying the initial conditions. For the recurrence \( a_n = 2a_{n-1} + 3a_{n-2} \), this gives the following two linear equations:
|
||||
|
||||
1. \( \alpha_1 3^0 + \alpha_2 (-1)^0 = a_0 \) (this gives the equation for \( a_0 \))
|
||||
2. \( \alpha_1 3^1 + \alpha_2 (-1)^1 = a_1 \) (this gives the equation for \( a_1 \))
|
||||
|
||||
These equations are:
|
||||
|
||||
\[
|
||||
\alpha_1 + \alpha_2 = a_0
|
||||
\]
|
||||
\[
|
||||
3 \alpha_1 - \alpha_2 = a_1
|
||||
\]
|
||||
|
||||
### Step 5: Solve the System of Equations
|
||||
|
||||
We can now solve this system of two linear equations for \( \alpha_1 \) and \( \alpha_2 \). Add the two equations:
|
||||
|
||||
\[
|
||||
(\alpha_1 + \alpha_2) + (3 \alpha_1 - \alpha_2) = a_0 + a_1
|
||||
\]
|
||||
\[
|
||||
4 \alpha_1 = a_0 + a_1
|
||||
\]
|
||||
\[
|
||||
\alpha_1 = \frac{a_0 + a_1}{4}
|
||||
\]
|
||||
|
||||
Substitute \( \alpha_1 = \frac{a_0 + a_1}{4} \) into \( \alpha_1 + \alpha_2 = a_0 \):
|
||||
|
||||
\[
|
||||
\frac{a_0 + a_1}{4} + \alpha_2 = a_0
|
||||
\]
|
||||
\[
|
||||
\alpha_2 = a_0 - \frac{a_0 + a_1}{4} = \frac{3a_0 - a_1}{4}
|
||||
\]
|
||||
|
||||
### Step 6: Write the General Formula for \( a_n \)
|
||||
|
||||
Now we substitute \( \alpha_1 \) and \( \alpha_2 \) back into the formula for \( a_n \):
|
||||
|
||||
\[
|
||||
a_n = \alpha_1 3^{n-1} + \alpha_2 (-1)^{n-1}
|
||||
\]
|
||||
\[
|
||||
a_n = \frac{a_0 + a_1}{4} 3^{n-1} + \frac{3a_0 - a_1}{4} (-1)^{n-1}
|
||||
\]
|
||||
|
||||
This is the closed-form formula for \( a_n \), which you can now use to compute \( a_n \) directly for any \( n \), given the initial conditions \( a_0 \) and \( a_1 \).
|
||||
|
||||
### Final Formula:
|
||||
|
||||
\[
|
||||
a_n = \frac{a_0 + a_1}{4} 3^{n-1} + \frac{3a_0 - a_1}{4} (-1)^{n-1}
|
||||
\]
|
||||
|
||||
This formula allows you to compute \( a_n \) directly without needing to iterate through the recurrence!
|
||||
Reference in New Issue
Block a user