Care is needed when dealing with multivalued functions because identities that hold for positive scalars can fail in the complex plane. For example, it is not always true that or for all . Here, the square root is the principal square root (the one lying in the right half-plane) and the logarithm is the principal logarithm (the one with imaginary part in ).

A powerful tool for dealing with multivalued complex functions is the *unwinding number*, defined for by

The unwinding number provides a correction term for the putative identity , in that

for all .

A useful formula for the unwinding number is

where is the ceiling function, which returns the smallest integer greater than or equal to its argument. It follows that if and only if . Hence if and only if .

The unwinding number provides correction terms for various identities. For example, for , replacing by in ), we have

This gives the identities

Note that in textbooks one can find identities such as , in which each occurrence of is interpreted as a possibly different branch. For computational purposes we want formulas that contain a specific branch, usually the principal branch.

An application of the unwinding number to matrix functions is in computing the logarithm of a upper triangular matrix. For any function , we have

where the divided difference

When this formula suffers from numerical cancellation. For the logarithm, we can rewrite it, using , as

where . Using the hyperbolic arc tangent, defined by

we obtain

Assuming that we have an accurate function this formula will provide an accurate value of provided that is not too close to (the singularities of ) and not too large. This formula is used in the MATLAB function `logm`

.

## Matrix Unwinding Function

The unwinding number leads to the *matrix unwinding function*, defined for by

Here, is the principal matrix logarithm, defined by the property that its eigenvalues have imaginary parts in the interval . It can be shown that if and only if the imaginary parts of all the eigenvalues of lie in the interval . Furthermore, is a diagonalizable matrix with integer eigenvalues.

As an example, the matrix

has unwinding matrix function

In general, if is real then is pure imaginary as long as has no eigenvalue with imaginary part that is an odd multiple of .

The matrix unwinding function is useful for providing correction terms for matrix identities involving multivalued functions. Here are four useful matrix identities, along with cases in which the correction term vanishes. See Aprahamian and Higham (2014) for proofs.

- For nonsingular and ,
If is an integer then the correction term is . If and then and so

and this equation is obviously true for , too.

- If and are nonsingular and then
If for every eigenvalue of and the corresponding eigenvalue of (there is a correspondence because of the commutativity of and , which implies that they are simultaneously unitarily diagonalizable), then .

- If and are nonsingular and then for any ,
If is an integer or the eigenvalues of and have arguments in then .

- For nonsingular and .
If then , and this equation also holds for if has no negative eigenvalues.

The matrix unwinding function can be computed by an adaptation of the Schur–Parlett algorithm. The algorithm computes a Schur decomposition and re-orders it into a block form with eigenvalues having the same unwinding number in the same diagonal block. The unwinding function of each diagonal block is then a multiple of the identity and the off-diagonal blocks are obtained by the block Parlett recurrence. This approach gives more accurate results than directly evaluating from its definition in terms of the matrix logarithm and natrix exponential. A MATLAB code `unwindm`

is available at https://github.com/higham/unwinding

## Matrix Argument Reduction

The matrix unwinding function can be of use computationally for reducing the size of the imaginary parts of the eigenvalues of a matrix. The function

has eigenvalues with . Using in place of can be useful in computing the matrix exponential by the scaling and squaring algorithm because and can have a much smaller norm than , giving potential reductions in cost. Combined with the Schur decomposition-based algorithm for mentioned above, this idea leads to a numerical method for . See Aprahamian and Higham (2014) for details.

## Round Trip Relations

If you apply a matrix function and then its inverse do you get back to where you started, that is, is ? In principle yes, but if the inverse is multivalued the answer is not immediate. The matrix unwinding function is useful for analyzing such round trip relations. As an example, if has no eigenvalues with real part of the form for an integer , then

Here, is the principal arc cosine defined in Aprahamian and Higham (2016), where this result and analogous results for the arc sine, arc hyperbolic cosine, and arc hyperbolic sine are derived; and is the matrix sign function.

## History

The unwinding number was introduced by Corless, Hare and Jeffrey in 1996, to help implement computer algebra over the complex numbers. It was generalized to the matrix case by Aprahamian and Higham (2014).

## References

This is a minimal set of references, which contain further useful references within.

- Mary Aprahamian and Nicholas J. Higham, The Matrix Unwinding Function, with an Application to Computing the Matrix Exponential, SIAM J. Matrix Anal. Appl. 35(1), 88–109, 2014.
- Mary Aprahamian and Nicholas J. Higham, Matrix Inverse Trigonometric and Inverse Hyperbolic Functions: Theory and Algorithms, SIAM J. Matrix Anal. Appl. 37(4), 1453–1477, 2016.
- Robert Corless and David Jeffrey, The Unwinding Number, SIGSAM Bull 30(2), 28–35, 1996.
- David Jeffrey, D. E. G. Hare and Robert Corless, Unwinding the Branches of the Lambert W Function, Math. Scientist 21, 1–7, 1996.
- Nicholas J. Higham, Functions of Matrices: Theory and Computation, Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2008.

## Related Blog Posts

- What Is a Matrix Function? (2020)
- What Is a Matrix Square Root? (2020)
- What Is the Matrix Logarithm? (2020)
- What Is the Matrix Exponential? (2020)

This article is part of the “What Is” series, available from https://nhigham.com/category/what-is and in PDF form from the GitHub repository https://github.com/higham/what-is.