# sqrtm

Matrix square root

## Description

`X = sqrtm(`

returns
the principal square root of the matrix `A`

)`A`

, that
is, `X*X = A`

.

`X`

is the unique square root for which every
eigenvalue has nonnegative real part. If `A`

has
any eigenvalues with negative real parts, then a complex result is
produced. If `A`

is singular, then `A`

might
not have a square root. If exact singularity is detected, a warning
is printed.

`[X,residual] = sqrtm(`

also
returns the residual, `A`

)`residual = norm(A-X^2,1)/norm(A,1)`

.
This syntax does not print warnings if exact singularity is detected.

`[X,alpha,condx] = sqrtm(`

returns
stability factor `A`

)`alpha`

and an estimate of the matrix
square root condition number of `X`

in 1-norm, `condx`

.
The residual `norm(A-X^2,1)/norm(A,1)`

is bounded
approximately by `n*alpha*eps`

and the 1-norm relative
error in `X`

is bounded approximately by `n*alpha*condx*eps`

,
where `n = max(size(A))`

.

## Examples

## Input Arguments

## Tips

Some matrices, like

`A = [0 1; 0 0]`

, do not have any square roots, real or complex, and`sqrtm`

cannot be expected to produce one.

## Algorithms

The algorithm `sqrtm`

uses is described in [3].

## References

[1] N.J. Higham, “Computing real square
roots of a real matrix,” *Linear Algebra and Appl.*,
88/89, pp. 405–430, 1987

[2] Bjorck, A. and S. Hammerling, “A
Schur method for the square root of a matrix,” *Linear
Algebra and Appl.*, 52/53, pp. 127–140, 1983

[3] Deadman, E., Higham, N. J. and R. Ralha,
“Blocked Schur algorithms for computing the matrix square root,” *Lecture
Notes in Comput. Sci.*, 7782, Springer-Verlag, pp. 171–182,
2013

## Extended Capabilities

## Version History

**Introduced before R2006a**