# Magnus expansion

In mathematics and physics, the Magnus expansion, named after Wilhelm Magnus (1907–1990), provides an exponential representation of the product integral solution of a first-order homogeneous linear differential equation for a linear operator. In particular, it furnishes the fundamental matrix of a system of linear ordinary differential equations of order n with varying coefficients. The exponent is aggregated as an infinite series, whose terms involve multiple integrals and nested commutators.

## The deterministic case
### Magnus approach and its interpretation

Given the n × n coefficient matrix A(t), one wishes to solve the initial-value problem associated with the linear ordinary differential equation
    $Y'(t)=A(t)Y(t),\quad Y(t_{0})=Y_{0}$
for the unknown n-dimensional vector function Y(t).
When n = 1, the solution is given as a product integral
    $Y(t)=\exp \left(\int _{t_{0}}^{t}A(s)\,ds\right)Y_{0}.$
This is still valid for n > 1 if the matrix A(t) satisfies A(t$_1$) A(t$_2$) = A(t$_2$) A(t$_1$) for any pair of values of t, t$_1$ and t$_2$. In particular, this is the case if the matrix A is independent of t. In the general case, however, the expression above is no longer the solution of the problem.
The approach introduced by Magnus to solve the matrix initial-value problem is to express the solution by means of the exponential of a certain n × n matrix function
Ω(t, t$_0$):
    $Y(t)=\exp {\big\Omega (t,t_{0}){\big )}\,Y_{0},$
which is subsequently constructed as a series expansion:
    $\Omega (t)=\sum _{k=1}^{\infty }\Omega _{k}(t),$
where, for simplicity, it is customary to write Ω(t) for Ω(t, t$_0$) and to take t$_0$ = 0.
Magnus appreciated that, since ⁠d/dt⁠ (e$^Ω$) e$^{−Ω}$ = A(t), using a Poincaré−Hausdorff matrix identity, he could relate the time derivative of Ω to the generating function of Bernoulli numbers and the adjoint endomorphism of Ω,
    $\Omega '={\frac {\operatorname {ad} _{\Omega }}{\exp(\operatorname {ad} _{\Omega })-1}}A,$
to solve for Ω recursively in terms of A "in a continuous analog of the BCH expansion", as outlined in a subsequent section.
The equation above constitutes the Magnus expansion, or Magnus series, for the solution of matrix linear initial-value problem. The first four terms of this series read
    ${\begin{aligned}\Omega _{1}(t)&=\int _{0}^{t}A(t_{1})\,dt_{1},\\\Omega _{2}(t)&={\frac {1}{2}}\int _{0}^{t}dt_{1}\int _{0}^{t_{1}}dt_{2}\,[A(t_{1}),A(t_{2})],\\\Omega _{3}(t)&={\frac {1}{6}}\int _{0}^{t}dt_{1}\int _{0}^{t_{1}}dt_{2}\int _{0}^{t_{2}}dt_{3}\,{\Bigl{\bigA(t_{1}),[A(t_{2}),A(t_{3})]{\big ]}+{\bigA(t_{3}),[A(t_{2}),A(t_{1})]{\big ]}{\Bigr )},\\\Omega _{4}(t)&={\frac {1}{12}}\int _{0}^{t}dt_{1}\int _{0}^{t_{1}}dt_{2}\int _{0}^{t_{2}}dt_{3}\int _{0}^{t_{3}}dt_{4}\,\left({\Big{\big[A_{1},A_{2}],A_{3}{\big ]},A_{4}{\Big ]}\right.\\&\qquad +{\BigA_{1},{\big[A_{2},A_{3}],A_{4}{\big ]}{\Big ]}+{\BigA_{1},{\bigA_{2},[A_{3},A_{4}]{\big ]}{\Big ]}+\left.{\BigA_{2},{\bigA_{3},[A_{4},A_{1}]{\big ]}{\Big ]}\right),\end{aligned}}$
where [A, B] ≡ A B − B A is the matrix commutator of A and B.
These equations may be interpreted as follows: Ω$_1$(t) coincides exactly with the exponent in the scalar (n = 1) case, but this equation cannot give the whole solution. If one insists in having an exponential representation (Lie group), the exponent needs to be corrected. The rest of the Magnus series provides that correction systematically: Ω or parts of it are in the Lie algebra of the Lie group on the solution.
In applications, one can rarely sum exactly the Magnus series, and one has to truncate it to get approximate solutions. The main advantage of the Magnus proposal is that the truncated series very often shares important qualitative properties with the exact solution, at variance with other conventional perturbation theories. For instance, in classical mechanics the symplectic character of the time evolution is preserved at every order of approximation. Similarly, the unitary character of the time evolution operator in quantum mechanics is also preserved (in contrast, e.g., to the Dyson series solving the same problem).

### Convergence of the expansion

From a mathematical point of view, the convergence problem is the following: given a certain matrix A(t), when can the exponent Ω(t) be obtained as the sum of the Magnus series?
A sufficient condition for this series to converge for t ∈ [0,T) is
    $\int _{0}^{T}\|A(s)\|_{2}\,ds<\pi ,$
where $\|\cdot \|_{2}$ denotes a matrix norm. This result is generic in the sense that one may construct specific matrices A(t) for which the series diverges for any t > T.

### Magnus generator

A recursive procedure to generate all the terms in the Magnus expansion utilizes the matrices S$_n$$^{(k)}$ defined recursively through
    $S_{n}^{(j)}=\sum _{m=1}^{n-j}\left[\Omega _{m},S_{n-m}^{(j-1)}\right],\quad 2\leq j\leq n-1,$
    $S_{n}^{(1)}=\left[\Omega _{n-1},A\right],\quad S_{n}^{(n-1)}=\operatorname {ad} _{\Omega _{1}}^{n-1}(A),$
which then furnish
    $\Omega _{1}=\int _{0}^{t}A(\tau )\,d\tau ,$
    $\Omega _{n}=\sum _{j=1}^{n-1}{\frac {B_{j}}{j!}}\int _{0}^{t}S_{n}^{(j)}(\tau )\,d\tau ,\quad n\geq 2.$
Here ad$^k$$_Ω$ is a shorthand for an iterated commutator (see adjoint endomorphism):
    $\operatorname {ad} _{\Omega }^{0}A=A,\quad \operatorname {ad} _{\Omega }^{k+1}A=[\Omega ,\operatorname {ad} _{\Omega }^{k}A],$
while B$_j$ are the Bernoulli numbers with B$_1$ = −1/2.
Finally, when this recursion is worked out explicitly, it is possible to express Ω$_n$(t) as a linear combination of n-fold integrals of n − 1 nested commutators involving n matrices A:
    $\Omega _{n}(t)=\sum _{j=1}^{n-1}{\frac {B_{j}}{j!}}\sum _{k_{1}+\cdots +k_{j}=n-1 \atop k_{1}\geq 1,\ldots ,k_{j}\geq 1}\int _{0}^{t}\operatorname {ad} _{\Omega _{k_{1}}(\tau )}\operatorname {ad} _{\Omega _{k_{2}}(\tau )}\cdots \operatorname {ad} _{\Omega _{k_{j}}(\tau )}A(\tau )\,d\tau ,\quad n\geq 2,$
which becomes increasingly intricate with n.

## The stochastic case
### Extension to stochastic ordinary differential equations

For the extension to the stochastic case let (W$_t$)$_{t∈[0, T]}${\textstyle \left(W_{t}\right)_{t\in [0, T]}} be a R$^q${\textstyle \mathbb {R} ^{q}}-dimensional Brownian motion, q∈N$_{>0}${\textstyle q\in \mathbb {N} _{>0}}, on the probability space (Ω, F, P){\textstyle \left(\Omega , {\mathcal {F}}, \mathbb {P} \right)} with finite time horizon T>0{\textstyle T>0} and natural filtration. Now, consider the linear matrix-valued stochastic Itô differential equation (with Einstein's summation convention over the index j)
    $dX_{t}=B_{t}X_{t}dt+A_{t}^{(j)}X_{t}dW_{t}^{j},\quad X_{0}=I_{d},\qquad d\in \mathbb {N} _{>0},$
where B$_⋅$, A$_⋅$$^{(1)}$, …, A$_⋅$$^{(j)}${\textstyle B_{\cdot }, A_{\cdot }^{(1)}, \dots , A_{\cdot }^{(j)}} are progressively measurable d×d{\textstyle d\times d}-valued bounded stochastic processes and I$_d${\textstyle I_{d}} is the identity matrix. Following the same approach as in the deterministic case with alterations due to the stochastic setting the corresponding matrix logarithm will turn out as an Itô-process, whose first two expansion orders are given by Y$_t$$^{(1)}$=Y$_t$$^{(1, 0)}$+Y$_t$$^{(0, 1)}${\textstyle Y_{t}^{(1)}=Y_{t}^{(1, 0)}+Y_{t}^{(0, 1)}} and Y$_t$$^{(2)}$=Y$_t$$^{(2, 0)}$+Y$_t$$^{(1, 1)}$+Y$_t$$^{(0, 2)}${\textstyle Y_{t}^{(2)}=Y_{t}^{(2, 0)}+Y_{t}^{(1, 1)}+Y_{t}^{(0, 2)}}, where with Einstein's summation convention over i and j
    ${\begin{aligned}Y_{t}^{(0,0)}&=0,\\Y_{t}^{(1,0)}&=\int _{0}^{t}A_{s}^{(j)}\,dW_{s}^{j},\\Y_{t}^{(0,1)}&=\int _{0}^{t}B_{s}\,ds,\\Y_{t}^{(2,0)}&=-{\frac {1}{2}}\int _{0}^{t}{\bigA_{s}^{(j)}{\big )}^{2}\,ds+{\frac {1}{2}}\int _{0}^{t}{\BigA_{s}^{(j)},\int _{0}^{s}A_{r}^{(i)}\,dW_{r}^{i}{\Big ]}dW_{s}^{j},\\Y_{t}^{(1,1)}&={\frac {1}{2}}\int _{0}^{t}{\BigB_{s},\int _{0}^{s}A_{r}^{(j)}\,dW_{r}{\Big ]}\,ds+{\frac {1}{2}}\int _{0}^{t}{\BigA_{s}^{(j)},\int _{0}^{s}B_{r}\,dr{\Big ]}\,dW_{s}^{j},\\Y_{t}^{(0,2)}&={\frac {1}{2}}\int _{0}^{t}{\BigB_{s},\int _{0}^{s}B_{r}\,dr{\Big ]}\,ds.\end{aligned}}$

### Convergence of the expansion

In the stochastic setting the convergence will now be subject to a stopping time τ{\textstyle \tau } and a first convergence result is given by:
Under the previous assumption on the coefficients there exists a strong solution X=(X$_t$)$_{t∈[0, T]}${\textstyle X=(X_{t})_{t\in [0, T]}}, as well as a strictly positive stopping time τ≤T{\textstyle \tau \leq T} such that:
* X$_t${\textstyle X_{t}} has a real logarithm Y$_t${\textstyle Y_{t}} up to time τ{\textstyle \tau }, i.e.
    $X_{t}=e^{Y_{t}},\qquad 0\leq t<\tau ;$
* the following representation holds P{\textstyle \mathbb {P} }-almost surely:
    $Y_{t}=\sum _{n=0}^{\infty }Y_{t}^{(n)},\qquad 0\leq t<\tau ,$
    where Y$^{(n)}${\textstyle Y^{(n)}} is the n-th term in the stochastic Magnus expansion as defined below in the subsection Magnus expansion formula;
* there exists a positive constant C, only dependent on ‖A$^{(1)}$‖$_T$, …, ‖A$^{(q)}$‖$_T$, ‖B‖$_T$, T, d{\textstyle \|A^{(1)}\|_{T}, \dots , \|A^{(q)}\|_{T}, \|B\|_{T}, T, d}, with ‖A$_⋅$‖$_T$=‖‖A$_t$‖$_F$‖$_{L∞(Ω×[0, T])}${\textstyle \|A_{\cdot }\|_{T}=\|\|A_{t}\|_{F}\|_{L^{\infty }(\Omega \times [0, T])}}, such that
    $\mathbb {P} (\tau \leq t)\leq Ct,\qquad t\in [0,T].$

### Magnus expansion formula

The general expansion formula for the stochastic Magnus expansion is given by:
    $Y_{t}=\sum _{n=0}^{\infty }Y_{t}^{(n)}\quad {\text{with}}\quad Y_{t}^{(n)}:=\sum _{r=0}^{n}Y_{t}^{(r,n-r)},$
where the general term Y$^{(r, n−r)}${\textstyle Y^{(r, n-r)}} is an Itô-process of the form:
    $Y_{t}^{(r,n-r)}=\int _{0}^{t}\mu _{s}^{r,n-r}ds+\int _{0}^{t}\sigma _{s}^{r,n-r,j}dW_{s}^{j},\qquad n\in \mathbb {N} _{0},\ r=0,\dots ,n,$
The terms σ$^{r, n−r, j}$, μ$^{r, n−r}${\textstyle \sigma ^{r, n-r, j}, \mu ^{r, n-r}} are defined recursively as
    ${\begin{aligned}\sigma _{s}^{r,n-r,j}&:=\sum _{i=0}^{n-1}{\frac {\beta _{i}}{i!}}S_{s}^{r-1,n-r,i}{\bigA^{(j)}{\big )},\\\mu _{s}^{r,n-r}&:=\sum _{i=0}^{n-1}{\frac {\beta _{i}}{i!}}S_{s}^{r,n-r-1,i}(B)-{\frac {1}{2}}\sum _{j=1}^{q}\sum _{i=0}^{n-2}{\frac {\beta _{i}}{i!}}\sum _{q_{1}=2}^{r}\sum _{q_{2}=0}^{n-r}S^{r-q_{1},n-r-q_{2},i}{\bigQ^{q_{1},q_{2},j}{\big )},\end{aligned}}$
with
    ${\begin{aligned}Q_{s}^{q_{1},q_{2},j}:=\sum _{i_{1}=2}^{q_{1}}\sum _{i_{2}=0}^{q_{2}}\sum _{h_{1}=1}^{i_{1}-1}\sum _{h_{2}=0}^{i_{2}}&\sum _{p_{1}=0}^{q_{1}-i_{1}}\sum _{{p_{2}}=0}^{q_{2}-i_{2}}\ \sum _{m_{1}=0}^{p_{1}+p_{2}}\ \sum _{{m_{2}}=0}^{q_{1}-i_{1}-p_{1}+q_{2}-i_{2}-p_{2}}\\&{\Bigg{{\frac {S_{s}^{p_{1},p_{2},m_{1}}{\big\sigma _{s}^{h_{1},h_{2},j}{\big )}}{({m_{1}}+1)!}}{\frac {S_{s}^{q_{1}-i_{1}-p_{1},q_{2}-i_{2}-p_{2},m_{2}}{\big\sigma _{s}^{i_{1}-h_{1},i_{2}-h_{2},j}{\big )}}{({m_{2}}+1)!}}}\\&\qquad \qquad +{\frac {{\bigS_{s}^{p_{1},p_{2},m_{1}}{\big\sigma _{s}^{i_{1}-h_{1},i_{2}-h_{2},j}{\big )},S_{s}^{q_{1}-i_{1}-p_{1},q_{2}-i_{2}-p_{2},m_{2}}{\big\sigma _{s}^{h_{1},h_{2},j}{\big )}{\big ]}}{({m_{1}}+{m_{2}}+2)({m_{1}}+1)!{m_{2}}!}}{\Bigg )},\end{aligned}}$
and with the operators S being defined as
    ${\begin{aligned}S_{s}^{r-1,n-r,0}(A)&:={\begin{cases}A&{\text{if }}r=n=1,\\0&{\text{otherwise}},\end{cases}}\\S_{s}^{r-1,n-r,i}(A)&:=\sum _{\begin{array}{c}(j_{1},k_{1}),\dots ,(j_{i},k_{i})\in \mathbb {N} _{0}^{2}\\j_{1}+\cdots +j_{i}=r-1\\k_{1}+\cdots +k_{i}=n-r\end{array}}{\bigY_{s}^{(j_{1},k_{1})},{\big\dots ,{\bigY_{s}^{(j_{i},k_{i})},A_{s}{\big ]}\dots {\big ]}{\big ]}\\&=\sum _{\begin{array}{c}(j_{1},k_{1}),\dots ,(j_{i},k_{i})\in \mathbb {N} _{0}^{2}\\j_{1}+\cdots +j_{i}=r-1\\k_{1}+\cdots k_{i}=n-r\end{array}}\operatorname {ad} _{Y_{s}^{(j_{1},k_{1})}}\circ \cdots \circ \operatorname {ad} _{Y_{s}^{(j_{i},k_{i})}}(A_{s}),\qquad i\in \mathbb {N} .\end{aligned}}$

## Applications

Since the 1960s, the Magnus expansion has been successfully applied as a perturbative tool in numerous areas of physics and chemistry, from atomic and molecular physics to nuclear magnetic resonance and quantum electrodynamics. It has been also used since 1998 as a tool to construct practical algorithms for the numerical integration of matrix linear differential equations. As they inherit from the Magnus expansion the preservation of qualitative traits of the problem, the corresponding schemes are prototypical examples of geometric numerical integrators.