I saw a tutorial on this long ago, but lost it. I know that the Pauli-Z operator compiles to Rz, but how? Here are the steps I remember:

First, we have to solve for $U(t)$ in the Schrodinger equation for time-independent Hamiltonians:

$$U(t) = e^{-iHt}$$

It's weird to have a matrix in an exponent, so we use the Taylor series expansion of the exponential function:

$$ e^x = \sum_{n=0}^{n=\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \ldots $$

Which gives us:

$$ U(t) = e^{-iHt} = \sum_{n=0}^{n=\infty} \frac{(-iHt)^n}{n!} = 1 + (-iHt) + \frac{(-iHt)^2}{2!} + \frac{(-iHt)^3}{3!} + \ldots $$

Now we use the Taylor series expansions for sine and cosine:

$$ \sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots $$

$$ \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots $$

I know there's some way of rewriting $U(t)$ in terms of sine and cosine, then I need to get to Rz:

$$ Rz = \begin{bmatrix} e^{-i \frac{\theta}{2}} & 0 \\ 0 & e^{i \frac{\theta}{2}} \end{bmatrix} $$

What are the steps I'm missing? Thanks!

  • $\begingroup$ Pauli Z is the Hamiltonian of the system I want to simulate. I want to compile it to a gate for execution on a quantum computer - Hamiltonian simulation. This requires solving for $U(t)$. $\endgroup$
    – ahelwer
    Dec 21, 2019 at 21:41
  • $\begingroup$ Pauli Z is a diagonal matrix. You don't even need the Taylor series for exponentiating it. $e^{-iZt} = \text{diag}(e^{-it}, e^{it}) = R_z(\theta = 2t)$. $\endgroup$ Dec 21, 2019 at 22:19

3 Answers 3


There are certain misconceptions apparent from your question, and I'll attempt to clear those first.

  1. It's not weird to have matrices in the exponent. They arise very naturally when studying linear differential equations of the form $\frac{dx(t)}{dt} = ax(t)$ where $x$ is a real or complex variable. Such differential equations have unique solutions of the form $ke^{at}x(0)$. Now if you have a system of differential equations like $\mathbf{x}'(t) = \mathbf{A}(t)\mathbf{x}(t) := (x_1'(t) \ \ldots \ x_n'(t))^T = \mathbf{A}(t)(x_1(t) \ \ldots \ x_n(t))$ where $\mathbf A$ is a $n\times n$ matrix of real or complex coefficients, we suppose that the solution is of the form $\mathbf x(t) = e^{\mathbf At}\mathbf x(0)$ and then go forth and prove that it is indeed the correct and unique solution iff $e^\mathbf{A}$ is defined as $$\sum_{m=0}^{\infty}\frac{\mathbf{A}^m}{m!}.$$

    And no wonder, Schrödinger's equation is a linear (partial) differential equation that dictates the evolution of quantum states! Are you beginning to see the link now? Things can be made more rigorous here but I'd probably refer you to a differential equations textbook instead.

  2. Be very careful regarding the application of power series. The series expansion you wrote for $e^x$ only holds for real and complex numbers $x$. A matrix isn't a number! The point is, the exponential of a matrix is defined as a power series because real functions can be "lifted" to square matrix functions (cf. matrix function). To emphasize, $e^{-iHt}$ is defined as $\sum_{m=0}^{m=\infty} \frac{(-iHt)^m}{m!}$ and is not a Taylor expansion in the usual sense.

    I'll give you a quick idea of how the definition of matrix exponentials $e^{\mathbf{A}}$ is motivated from the study of linear differential equations. Consider the linear ordinary differential equation system

    $$\frac{d}{dt}\mathbf{y}(t) = \mathbf{A} \mathbf {y}(t)$$

    where $\mathbf{A}$ is a $k\times k$ matrix and $\mathbf{y}(t)$ is the column vector $(y_1(t),\ldots , y_k(t))^T$.

    From here $$\frac{d^2}{dt^2}\mathbf y(t)=\frac{d}{dt}\mathbf A\mathbf y(t)=\mathbf A\frac{d}{dt}\mathbf y(t)=\mathbf A^2\mathbf y(t)$$

    and by induction, you can show that

    $$\frac{d^n}{dt^n}\mathbf y(t)=\mathbf A^n\mathbf y(t).$$

    By application of Taylor's theorem about $t=0$

    $$\mathbf y(t)=\sum_{n=0}^\infty\left.\frac{d^n}{dt^n}\mathbf y(t)\right|_{t=0}\frac{t^n}{n!}=\sum_{n=0}^\infty\mathbf A^n\mathbf y(0)\frac{t^n}{n!}=\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}\mathbf y(0).$$

    Now the term $\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}$ is labelled $e^{\mathbf{A}t}$. So strictly speaking (reiterating what I said before), $\sum_{n=0}^\infty\frac{(\mathbf At)^n}{n!}$ is not the "Taylor expansion" of $e^{\mathbf{A}t}$ but rather its defintion. This is a subtle point but is absolutely necessary to keep in mind to avoid misconceptions. Most people who do not find matrix exponentials "intuitive" are really stuck at this point.

  3. Diagonal matrices like Pauli $Z$ have some nice properties. Firstly, a matrix like $\mathbf{A} = \mathrm{diag}(a_1, \ldots, a_n)$ has $n$ independent eigenvectors $e_1, \ldots, e_n$ and $n$ eigenvalues $a_1, \ldots, a_n$. Moreover, $$\mathbf{A}^m = \mathrm{diag}^m(a_1,\ldots , a_n) = \mathrm{diag}(a_1^m,\ldots, a_n^m)$$ which you can prove by induction. From the above you should be able to see that $$e^{\mathbf{A}} = \sum_{m=0}^{\infty} \frac{\mathbf{A}^m}{m!} = \mathrm{diag}(\sum_{m=0}^{\infty} \frac{a_1^m}{m!},\ldots,\sum_{m=0}^{\infty}\frac{a_n^m}{m!}) =\mathrm{diag}(e^{a_1}, \ldots, e^{a_n}).$$

  4. The Pauli $Z$ matrix is $\mathrm{diag}(1, -1)$ and thus, $-iZt = \mathrm{diag}(-it, it)$. And from the above discussion it is clear that $$e^{-iZt} = \mathrm{diag}(e^{-it}, e^{it}) = \begin{bmatrix}e^{-it} && 0 \\ 0 && e^{it}\end{bmatrix},$$ which matches your description of $R_z(\theta)$ when $\frac{\theta}{2} = t$ or $\theta = 2t$, and so $e^{-iZt} = R_z(\theta = 2t)$. The Hamiltonian simulation would be equivalent to performing a rotation about the $z$-axis (of the Bloch sphere) by an angle of $\theta = 2t$.

  5. Alternatively, for diagonal matrices, matrix functions $f(\mathbf{A}) $ can be directly defined as $\mathrm{diag}(f(a_1), \ldots, f(a_n)))$ instead of going via the power series definition (cf. diagonalizable matrices). This is the reason why I had earlier mentioned that it's possible to directly write down $e^{-iZt} = \text{diag}(e^{-it}, e^{it}) = R_z(\theta = 2t)$ without even invoking the Taylor series.

  6. The decomposition into sines and cosines and invoking of Euler's formula were unnecessary in your answer. Diagonal and diagonalizable matrices make things much simpler and that is often the case in quantum mechanics as we mostly deal with Hermitian matrices (note that all Hamiltonian operators are Hermitian). For infinite-dimensional operators, diagonalization manifests in form of the spectral theorem.

  7. Matrix exponentials (exponential maps) play a crucial role in the study of Lie groups and in translating them to Lie algebras. They're not merely some weird and ugly series expansion formulae, but are deeply rooted in differential geometry and can be visualized nicely in those terms. More on that some other day!

This answer became a bit lengthier than usual, but I hope that I at least managed to somewhat convince you as to why it's not weird to have matrices in exponents. :)


The Euler's formula for Pauli matrices $\sigma_i$ is $$e^{ix\sigma_i} = \cos(x)I + i\sin(x)\sigma_i$$ Applying it to $\sigma_z$ gives $$e^{ix\sigma_z} = \cos(x)I + i\sin(x)\sigma_z$$ and $$U(t) = e^{-i\sigma_zt} = \begin{bmatrix} e^{-it} & 0 \\ 0 & e^{it} \end{bmatrix} = R_z(2t)$$


So, you have:

$$ U(t) = e^{-iHt} = \sum_{n=0}^{n=\infty} \frac{(-iHt)^n}{n!} = 1 + (-iHt) + \frac{(-iHt)^2}{2!} + \frac{(-iHt)^3}{3!} + \ldots $$

which expands to:

$$ U(t) = 1 - i(Ht) - \frac{(Ht)^2}{2!} + \frac{i(Ht)^3}{3!} + \frac{(Ht)^4}{4!} - \frac{i(Ht)^5}{5!} - \frac{(Ht)^6}{6!} \ldots $$

Note that raising $-1$ and $i$ to different powers follows the cycle $1 \rightarrow -i \rightarrow -1 \rightarrow i \rightarrow 1$. Note also that for $H = \sigma_z$, $H^2 = \mathbb{I}$, the identity matrix. Thus the above series becomes:

$$ U(t) = 1 - i(Ht) - \frac{t^2}{2!} + \frac{iHt^3}{3!} + \frac{t^4}{4!} - \frac{iHt^5}{5!} - \frac{t^6}{6!} \ldots $$

Recall the Taylor series expansions of sine and cosine:

$$ \sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots $$

$$ \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots $$

You can extract $\cos(x)$ from the $U(t)$ series directly:

$$ U(t) = \cos(t) -iHt + \frac{iHt^3}{3!} - \frac{iHt^5}{5!} + \frac{iHt^7}{7!} + \ldots $$

From which it's easy to extract $\sin(x)$:

$$ U(t) = \cos(t) - iH \left( t - \frac{t^3}{3!} + \frac{t^5}{5!} - \frac{t^7}{7!} + \ldots \right) = \cos(t) - iH\sin(t) $$

Now multiply both sides of the equation by the identity matrix and expand $H$ to get:

$$ \begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}U(t) = \begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix} \left( \cos(t) - i \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\sin(t) \right) $$ $$ U(t) = \begin{bmatrix}\cos(t) & 0 \\ 0 & \cos(t)\end{bmatrix} - \begin{bmatrix} i\sin(t) & 0 \\ 0 & -i\sin(t) \end{bmatrix} $$ $$ U(t) = \begin{bmatrix}\cos(t) - i\sin(t) & 0 \\ 0 & \cos(t) + i\sin(t)\end{bmatrix} $$

Recall the identity for Euler's formula:

$$e^{ix} = \cos(x) + i\sin(x)$$

So we finally have:

$$U(t) = e^{-iHt} = \begin{bmatrix} e^{-it} & 0 \\ 0 & e^{it} \end{bmatrix} = Rz(2t)$$

  • $\begingroup$ This level of complication is absolutely unnecessary given that the exponential of diagonal matrices is well-known. The last step can be written down directly. $\endgroup$ Dec 21, 2019 at 22:27
  • $\begingroup$ I wouldn't say it's complicated; it uses primitives that are known to people who have taken first- or second-year university courses and is thus much easier to understand (at least for me). $\endgroup$
    – ahelwer
    Dec 21, 2019 at 22:29
  • $\begingroup$ I would welcome an explanation of exponentials of a diagonal matrix, though - if you type it up I'll mark your answer as accepted instead of mine (since I really just plowed through the expression manipulation instead of learning anything). $\endgroup$
    – ahelwer
    Dec 21, 2019 at 22:32
  • 1
    $\begingroup$ You can vastly simplify your proof by using the power series expansion of $e^x$ rather than $\sin(x)$ and $\cos(x)$ (there's no need to decompose into sines and cosines or use the Euler formula). I will perhaps write an answer tomorrow but I suppose you'll be able to figure it out yourself. Nevertheless, it's unfortunate that most introductory math courses treat matrix exponentiation as merely some artificial plugging-and-chugging into the Taylor series. There are far more elegant ways to view it. $\endgroup$ Dec 21, 2019 at 23:26
  • $\begingroup$ I actually never even learned matrix exponentiation in undergrad, sadly. The first time I saw a matrix in an exponent my brain split in half. Only then learned about the Taylor series expansion. $\endgroup$
    – ahelwer
    Dec 21, 2019 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.