You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

对称三对角矩阵的特征值分解及相关矩阵求解(MATLAB实现)

对称三对角矩阵的平方根分解实现(MATLAB)

Hey there, let's tackle this problem step by step. We need to work with that specific symmetric tridiagonal matrix $A$, compute the required matrices $U\sqrt{\Sigma}$ and $\sqrt{\Sigma}{-1}UT$ where $U\Sigma2UT = A$, all using MATLAB. Here's how to do it:

1. First, build the target matrix $A$

Looking at the structure of $A$:

  • The main diagonal entries follow the pattern $2N-1, 2N-3, ..., 1$ (for row/column $i$, it's $2N - (2i-1)$)
  • The off-diagonal entries (both upper and lower) are $N-1, N-2, ..., 1$ (for the $i$-th off-diagonal position, it's $N-i$)

We can construct this easily in MATLAB with the diag function:

function A = build_target_matrix(N)
    % Generate main diagonal elements
    main_diag = 2*N - (1:2:2*N-1);
    % Generate off-diagonal elements
    sub_diag = (N-1):-1:1;
    % Assemble the symmetric tridiagonal matrix
    A = diag(main_diag) + diag(sub_diag, 1) + diag(sub_diag, -1);
end

Test it with $N=3$ and you'll get the expected matrix:
$$
\begin{bmatrix}
5 & 2 & 0 \
2 & 3 & 1 \
0 & 1 & 1
\end{bmatrix}
$$

2. Perform eigenvalue decomposition

Since $A$ is symmetric, MATLAB's eig function will give us an orthogonal matrix $U$ and a diagonal eigenvalue matrix $\Lambda$ such that $A = U\Lambda U^T$. This is exactly the decomposition we need, because $\Sigma^2 = \Lambda$ (so $\Sigma$ is the square root of $\Lambda$).

% Set your desired N value here
N = 5;
% Build the matrix
A = build_target_matrix(N);
% Get orthogonal U and eigenvalue matrix Lambda
[U, Lambda] = eig(A);
% Compute Sigma as the square root of Lambda (diagonal matrix)
Sigma = sqrt(Lambda);

3. Calculate the target matrices

Now we just compute $U\sqrt{\Sigma}$ and $\sqrt{\Sigma}{-1}UT$. Since $\Sigma$ is diagonal, its square root is also diagonal (entries are the square roots of $\Sigma$'s entries, which are the 4th roots of $A$'s eigenvalues). The inverse of $\sqrt{\Sigma}$ is simply the diagonal matrix with entries that are reciprocals of $\sqrt{\Sigma}$'s entries.

% Compute sqrt(Sigma)
sqrt_Sigma = sqrt(Sigma);
% Calculate U*sqrt(Sigma)
U_sqrtSigma = U * sqrt_Sigma;

% Compute inverse of sqrt(Sigma)
inv_sqrtSigma = inv(sqrt_Sigma);
% Calculate sqrt(Sigma)^-1 * U^T
inv_sqrtSigma_Utrans = inv_sqrtSigma * U';

4. Verify your results

To make sure everything checks out, run these quick verifications:

  • Confirm $U$ is orthogonal: norm(U'*U - eye(N)) should be very close to 0 (within floating-point error)
  • Confirm $U\Sigma2UT = A$: norm(U * Sigma^2 * U' - A) should also be near 0
  • Check that $(U\sqrt{\Sigma})(\sqrt{\Sigma}U^T)$ squared equals $A$: norm( (U_sqrtSigma * (sqrt_Sigma * U'))^2 - A ) should be negligible

A quick note

This matrix $A$ is positive definite (strictly diagonally dominant with positive diagonal entries), so all eigenvalues are positive—no issues with complex numbers when taking square roots or inverses.

内容的提问来源于stack exchange,提问作者Olle Kjellqvist

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:47:05