<s>[INST] How to find the logarithm of Pauli Matrix? When I solve some physics problem, it helps a lot if I can find
the logarithm of Pauli matrix.

e.g. $\sigma_{x}=\left(\begin{array}{cc}
0 & 1\\
1 & 0
\end{array}\right)$, find the matrix $A$ such that $e^{A}=\sigma_{x}$.

At first, I find a formula only for real matrix:
$$\exp\left[\left(\begin{array}{cc}
a & b\\
c & d
\end{array}\right)\right]=\frac{e^{\frac{a+d}{2}}}{\triangle}\left(\begin{array}{cc}
\triangle \cosh(\frac{\triangle}{2})+(a-d)\sinh(\frac{\triangle}{2}) & 2b\cdot \sinh(\frac{\triangle}{2})\\
2c\cdot \sinh(\frac{\triangle}{2}) & \triangle \cosh(\frac{\triangle}{2})+(d-a)\sinh(\frac{\triangle}{2})
\end{array}\right)$$
where $\triangle=\sqrt{\left(a-d\right)^{2}+4bc}$
but there is no solution for the formula on this example;
After that, I try to Taylor expand the logarithm of $\sigma_{x}$:
$$
\log\left[I+\left(\sigma_{x}-I\right)\right]=\left(\sigma_{x}-I\right)-\frac{\left(\sigma_{x}-I\right)^{2}}{2}+\frac{\left(\sigma_{x}-I\right)^{3}}{3}...
$$
$$
\left(\sigma_{x}-I\right)=\left(\begin{array}{cc}
-1 & 1\\
1 & 1
\end{array}\right)\left(\begin{array}{cc}
-2 & 0\\
0 & 0
\end{array}\right)\left(\begin{array}{cc}
-\frac{1}{2} & \frac{1}{2}\\
\frac{1}{2} & \frac{1}{2}
\end{array}\right)
$$
\begin{eqnarray*}
\log\left[I+\left(\sigma_{x}-I\right)\right] & = & \left(\begin{array}{cc}
-1 & 1\\
1 & 1
\end{array}\right)\left[\left(\begin{array}{cc}
-2 & 0\\
0 & 0
\end{array}\right)-\left(\begin{array}{cc}
\frac{\left(-2\right)^{2}}{2} & 0\\
0 & 0
\end{array}\right)...\right]\left(\begin{array}{cc}
-\frac{1}{2} & \frac{1}{2}\\
\frac{1}{2} & \frac{1}{2}
\end{array}\right)\\
 & = & \left(\begin{array}{cc}
-1 & 1\\
1 & 1
\end{array}\right)\left(\begin{array}{cc}
-\infty & 0\\
0 & 0
\end{array}\right)\left(\begin{array}{cc}
-\frac{1}{2} & \frac{1}{2}\\
\frac{1}{2} & \frac{1}{2}
\end{array}\right)
\end{eqnarray*}
this method also can't give me a solution.
 [/INST] Observe that 
\begin{equation}
\sigma_{z} = \begin{pmatrix}1&0\\0&-1\end{pmatrix} = \exp(B) = \sum_{r=0}^{\infty} \frac{B^{r}}{r!}
\end{equation}
with
\begin{equation}
B = i\pi\begin{pmatrix}2m&0\\0&2n+1\end{pmatrix},
\end{equation}
where $m,n\in\mathbb{Z}$.
Next, notice that
\begin{equation}
\sigma_{x} = U \sigma_{z} U^{\dagger}
\end{equation}
with
\begin{equation}
U = \exp(-i\pi\sigma_{y}/4)= \frac{1}{\sqrt{2}}(I - i\sigma_{y})= \frac{1}{\sqrt{2}} \begin{pmatrix}1&-1\\1&1\end{pmatrix}.
\end{equation}
Hence, we have
\begin{equation}
\sigma_{x} = \sum_{r=0}^{\infty} U\frac{B^{r}}{r!} U^{\dagger} = \sum_{r=0}^{\infty} \frac{(UBU^{\dagger})^{r}}{r!} = \exp(A)
\end{equation}
with
\begin{equation}
\begin{split}
A &= UBU^{\dagger} = i\pi U\left[\left(m+n+\frac{1}{2}\right)I + \left(m-n-\frac{1}{2}\right)\sigma_{z}\right]U^{\dagger}\\
&= i\pi \left[\left(m+n+\frac{1}{2}\right)I + \left(m-n-\frac{1}{2}\right)\sigma_{x}\right]\\
&= i\pi\begin{pmatrix}m + n + 1/2&m - n - 1/2\\m - n - 1/2&m + n + 1/2\end{pmatrix}.
\end{split}
\end{equation}
</s>