How this calculation works
Find the principal matrix square root with a checked matrix product and a stated spectral branch, rather than taking entrywise roots.
X²=A, with all eigenvalues of the principal root X in the open right half-plane.A worked example
For A=[[4,1],[0,9]], the principal root is X=[[2,1/5],[0,3]]. Multiplication gives X²=[[4,1],[0,9]], and trace(X)=5.
Good to know
Real square matrices of order 2–4, with spectrum resolved away from the nonpositive real axis. Scaled Denman–Beavers iteration, Schur spectral checks and reconstruction residual. Near-cut or unresolved cases rejected; no enumeration of other roots and no forward-error certificate.
Reference: Primary author or official method documentation (opens in a new tab) ↗
A matrix function rather than entrywise arithmetic
A matrix square root is a matrix X whose matrix product with itself equals A. Taking the square root of each entry generally does not satisfy that equation, because matrix multiplication combines rows and columns. Even a triangular example can need an off-diagonal entry that is not the scalar square root of the corresponding entry of A.
Matrices can have several square roots, infinitely many roots or no root under a given restriction. This calculator therefore names one branch: the principal matrix square root. The supported spectrum is separated from the nonpositive real axis, and the computed root must have eigenvalues with positive real parts before it is accepted.
Compare this with the Principal matrix logarithm calculator for positive definite matrices. Find a matrix X satisfying X²=A under a stated principal-root convention; this is a different matrix function from log(A), not an entrywise square root.
Enter a square matrix and preserve its structure
Use two through four rows with the same number of columns, entering each real finite entry explicitly. The page accepts nonsymmetric matrices as well as symmetric examples, so a result need not be symmetric. It does not first replace the matrix by its symmetric part or by a nearest positive-semidefinite approximation.
The matrix order and numerical scale affect conditioning. A very small residual can coexist with a substantial forward error when the square-root problem is sensitive. The calculator keeps the reconstruction diagnostic visible and rejects an unresolved spectral branch; it does not turn that residual into a universal bound on every entry of X.
Multiply the default root to check it
For A=[[4,1],[0,9]], write the upper-triangular root as X=[[2,b],[0,3]]. Squaring it gives diagonal entries four and nine, while the off-diagonal entry is 2b+3b. Requiring that entry to equal one gives b=1/5, so the correct root has 0.2 rather than one in that location.
The root trace is therefore five. Its positive eigenvalues two and three select the principal branch for this example. Choosing one negative diagonal root can produce another algebraic solution under suitable off-diagonal values, but that would be a different branch and is deliberately not returned under the principal-root label.
Separate iteration from branch checking
The implementation scales A and uses the coupled Denman–Beavers iteration to obtain a candidate root. Scaling keeps intermediate matrix magnitudes manageable. Each iteration involves matrix inverses, so singular or numerically unresolved intermediate systems cannot simply be ignored. A bounded iteration count prevents an unsuccessful calculation from running indefinitely in the browser.
Real Schur information is used to inspect the input spectrum and the candidate root spectrum. This is a branch check, not a claim that the root itself was computed by a Schur triangular recurrence. Distinguishing those steps makes the documented algorithm match what the calculator actually does and what its diagnostics can establish.
Interpret the reconstruction residual
The displayed residual compares X² with A using a matrix norm and the size of A. It measures how closely the returned candidate satisfies the defining equation in the supplied floating-point calculation. For the default upper-triangular matrix, the residual is near ordinary rounding precision because its root is particularly simple.
This residual is not the distance from X to the exact principal root. Nonnormal matrices and spectra near the excluded branch cut can make that distinction important. If a later computation is highly sensitive, an independent high-precision calculation or a condition estimate is more appropriate than treating the residual as an entrywise error bar.
Why the branch cut matters
The principal scalar square root has a discontinuity convention on the negative real axis. A related spectral issue appears for matrix functions. The page excludes eigenvalues on or numerically too close to the nonpositive real axis, where a real principal branch can be undefined or unresolved under the supported assumptions.
This restriction does not mean that every excluded matrix has no square root of any kind. For example, existence of a nonprincipal real root is a separate question. The calculator reports the limits of its principal-root task rather than turning a branch rejection into a sweeping mathematical nonexistence claim.
Reuse the returned matrix correctly
Keep the full matrix, its branch convention and the reconstruction diagnostic together. A trace or determinant alone cannot reproduce the off-diagonal structure of the root, and applying X twice means multiplying X by a vector twice, not multiplying each vector coordinate by a displayed scalar summary.
Before using the result in another matrix function or dynamical model, check the dimensions and multiplication order. Matrix products are generally noncommutative, even though X commutes with A when it is a well-defined function of A. No arbitrary root selection, complex-entry continuation or automatic correction of an invalid input matrix is performed here.
A few questions, answered
Why is this different from square-rooting every entry?
Matrix multiplication combines rows and columns, so an entrywise square root usually does not satisfy X²=A. The default off-diagonal entry is 1/5, not one.
Does an input rejection prove no square root exists?
No. The page supports one real principal branch under a separated-spectrum condition, not every possible real or complex matrix square root.
Is the residual an error bound for X?
No. It measures reconstruction of A by X². Sensitivity can make forward error much larger than that residual.
Which algorithm computes the candidate?
A scaled Denman–Beavers iteration computes it; Schur spectrum checks help resolve the input domain and principal branch.