Skip to content

sqrtm

Matrix square root.

X = sqrtm(A)
[X, resnorm] = sqrtm(A)
[X, alpha, condest] = sqrtm(A)

Returns the principal matrix square root X such that X * X = A. Uses the Schur method.

With two outputs, returns the residual norm resnorm = norm(A - X*X) / norm(A). With three outputs, returns a stability indicator alpha and a 1-norm condition estimate condest for the square-root problem.

A should not have non-positive real eigenvalues — those produce complex results that may not be the principal square root you want.

A = [4 0; 0 9];
sqrtm(A) % [2 0; 0 3]
X = sqrtm(magic(3));
norm(X*X - magic(3)) % near-zero
  • expm — Matrix exponential.
  • eig — Eigenvalues and eigenvectors.