Matrix Square Root Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

What Is a Matrix Square Root?

A matrix square root of a square matrix A is another matrix S such that

S2 = A,

where the square means matrix multiplication: S2 = S ยท S. This is the direct analogue of scalar square roots, where a number s satisfies s2 = a.

For matrices, the situation is more subtle than for real numbers:

Because of this, we often focus on the principal matrix square root. Informally, the principal square root is the one whose eigenvalues have non-negative real parts. When it exists, this choice makes the square root unique and numerically well behaved for a large class of matrices (in particular, matrices without eigenvalues on the closed negative real axis).

How the 2x2 Matrix Square Root Works

This calculator is designed specifically for 2x2 matrices. You enter the entries

A = [a11a12a21a22]

and it computes a matrix S such that S2 = A, when such a square root exists. Internally, the implementation relies on the sqrtm function from the math.js library, which uses a numerically stable algorithm based on the Schur decomposition.

Key Formulas (Trace, Determinant, and Eigenvalues)

For a 2x2 matrix, the most important scalar quantities are the trace and the determinant:

The eigenvalues of a 2x2 matrix are the roots of its characteristic polynomial. In MathML, the characteristic equation for eigenvalues ฮป is

ฮป^2 โˆ’ tr (A) ฮป + det (A) = 0

Solving this quadratic gives

ฮป1,2 = ( tr(A) ยฑ โˆš( tr(A)2 โˆ’ 4 det(A) ) ) / 2 .

If A is diagonalizable and has eigen-decomposition

A = V ฮ› Vโˆ’1,

then a matrix square root can be constructed formally as

S = V ฮ›1/2 Vโˆ’1,

where ฮ›1/2 is the diagonal matrix obtained by taking square roots of the eigenvalues. Choosing eigenvalue square roots with non-negative real parts corresponds to the principal square root.

Interpreting the Calculator Output

After entering your 2x2 matrix and pressing the compute button, the calculator returns a 2x2 matrix S. You can interpret it as follows:

By definition, the returned matrix satisfies (up to numerical rounding)

S ยท S ≈ A.

If you want to verify the result, you can multiply the output matrix by itself and compare it to your original matrix entries.

Worked Example: Simple Diagonal Matrix

Consider the 2x2 diagonal matrix

A = [4009].

The eigenvalues are clearly 4 and 9, both positive. A natural square root is the diagonal matrix

S = [2003],

because

S2 = [2003] [2003] = [4009] = A.

If you enter a11 = 4, a12 = 0, a21 = 0, and a22 = 9 into the calculator, it will output S (up to minor numerical rounding), because this is exactly the principal square root: its eigenvalues are +2 and +3, both non-negative.

Worked Example: Matrix With Complex Square Root

Now consider a negative scalar multiple of the identity, for example

A = [-100-1] = -I.

There is no real matrix S with S2 = -I. However, over the complex numbers we can take

S = [i00i],

since i2 = -1 and hence

S2 = [i00i] [i00i] = [-100-1] = A.

If you enter a11 = -1, a12 = 0, a21 = 0, and a22 = -1, the calculator will return a 2x2 matrix with purely imaginary diagonal entries. This demonstrates how complex-valued square roots naturally appear, even for real input matrices.

Comparison: Real vs Complex, Diagonal vs General 2x2

The table below summarizes how the nature of the input matrix influences the type of square root you may see.

Matrix type Example input A Nature of principal square root Typical calculator output
Positive diagonal diag(4, 9) Real, diagonal diag(2, 3)
Symmetric positive definite [2112] Real, symmetric Real entries; S2 = A
Negative identity -I = diag(-1, -1) Complex (no real root) Imaginary diagonal entries (e.g. i, i)
General real 2x2 Any real entries Real, complex, or none Real 2x2 matrix, complex 2x2, or error

Assumptions and Limitations

This calculator is powerful for experimentation and learning, but it operates under some important assumptions and limitations:

When to Use a Matrix Square Root

Matrix square roots appear in many theoretical and applied settings, including:

For many of these applications, especially when the matrix is symmetric positive definite (such as covariance matrices), the principal square root is the natural and preferred choice.

Practical Tips

Used with these points in mind, the 2x2 Matrix Square Root Calculator is a convenient way to explore and apply matrix square roots without doing the algebra by hand.

Enter matrix values to compute.

Embed this calculator

Copy and paste the HTML below to add the Matrix Square Root Calculator (2x2 Principal Root) to your website.