Problem calculating the sine of a matrix Given the matrix $A=\begin{pmatrix}-\frac{3\pi}{4} & \frac{\pi}{2}\\\frac{\pi}{2}&0\end{pmatrix}$, I want to calculate the sine $\sin(A)$.
I do so by diagonalizing A and plugging it in the power series of the sine:
\begin{align}
\sin (A) = \sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)!} A^{2k+1}.
\end{align}
The diagonalization leads to:
\begin{align}
A = \frac{1}{5}
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}
\begin{pmatrix}-\pi & 0\\0&\frac{\pi}{4}\end{pmatrix}
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}
\end{align}
and thus:
\begin{align}
A^n = \frac{1}{5}
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}
\begin{pmatrix}-\pi & 0\\0&\frac{\pi}{4}\end{pmatrix}^n
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}.
\end{align}
Hence:
\begin{align}
\sin (A) &= \begin{pmatrix}-2 & 1\\1&2\end{pmatrix}
\begin{pmatrix}\sin(-\pi) & 0\\0&\sin(\frac{\pi}{4})\end{pmatrix}
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}\\
&= \begin{pmatrix}-2 & 1\\1&2\end{pmatrix}
\begin{pmatrix}0 & 0\\0&\frac{1}{\sqrt{2}})\end{pmatrix}
\begin{pmatrix}-2 & 1\\1&2\end{pmatrix}\\
&= \frac{1}{5}\begin{pmatrix}\frac{1}{\sqrt{2}} & \sqrt{2}\\\sqrt{2}&2\sqrt{2}\end{pmatrix},
\end{align}
which differs from "Wolfram Alpha's result"
\begin{align}
\sin(A) &= \begin{pmatrix}-\frac{1}{\sqrt{2}} & 1\\ 1 & 0 \end{pmatrix} .
\end{align}
How can this happen?
 A: The problem is that Wolfram Alpha interprets "sin(A)" for a matrix A (or array of however many dimensions, or list of list of lists, or what have you) as meaning simply the result of applying sin component-wise.
This is not what you intended, and you did your intended calculation perfectly fine.
A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\,\mathsf{A} \equiv
\pars{\begin{array}{rc}
\ds{-\,{3\pi \over 4}} & \ds{\pi \over 2}
\\
\ds{\pi \over 2} & \ds{0}
\end{array}}\,,\qquad\sin\pars{\mathsf{A}} =\, ?}$

$$
\mbox{Note that}\quad\,\mathsf{A} =
-\,{3\pi \over 8}\,\sigma_{0} + {\pi \over 2}\,\sigma_{x} -
{3\pi \over 8}\,\sigma_{z} =
-\,{3\pi \over 8}\,\sigma_{0} + \vec{b}\cdot\vec{\sigma}\,,\qquad
\left\lbrace\begin{array}{rcr}
\ds{b_{x}} & \ds{=} & \ds{\pi \over 2} 
\\[1mm]
\ds{b_{y}} & \ds{=} & \ds{0} 
\\[1mm]
\ds{b_{z}} & \ds{=} & \ds{-\,{3\pi \over 8}} 
\end{array}\right.
$$
where $\ds{\sigma_{0}}$ is the $\ds{2 \times 2}$ identity matrix. $\ds{\braces{\sigma_{i},\ i = x,y,z}}$ are the $\ds{2 \times 2}$ Pauli Matrices  which satisfies
$$
\sigma_{i}^{2} = \sigma_{0}\,,\qquad
\left\lbrace\begin{array}{rcccl}
\ds{\sigma_{x}\sigma_{y}} & \ds{=} & \ds{-\sigma_{y}\sigma_{x}} & \ds{=} & \ds{\ic\sigma_{z}}
\\
\ds{\sigma_{y}\sigma_{z}} & \ds{=} & \ds{-\sigma_{z}\sigma_{y}} & \ds{=} & \ds{\ic\sigma_{x}}
\\\ds{\sigma_{z}\sigma_{x}} & \ds{=} & \ds{-\sigma_{x}\sigma_{z}} & \ds{=} & \ds{\ic\sigma_{y}}
\end{array}\right.
$$

$\ds{\expo{\mu\vec{b}\cdot\vec{\sigma}}}$ satisfies
$\ds{\pars{\partiald[2]{}{\mu} - \vec{b}\cdot\vec{b}}\expo{\mu\vec{b}\cdot\vec{\sigma}} = 0}$ with
$\ds{\left.\expo{\mu\vec{b}\cdot\vec{\sigma}}\right\vert_{\ \mu\ =\ 0} = \sigma_{0}}$ and
$\ds{\left.\partiald{\expo{\mu\vec{b}\cdot\vec{\sigma}}}{\mu}
\right\vert_{\ \mu\ =\ 0} = \vec{b}\cdot\vec{\sigma}}$ such that
$\ds{\pars{~\mbox{note that}\ \vec{b}\cdot\vec{b} = \pars{5\pi \over 8}^{2}~}}$
\begin{align}
\expo{\mu\vec{b}\cdot\vec{\sigma}} & =
\cosh\pars{{5\pi \over 8}\,\mu}\sigma_{0} +
{8 \over 5\pi}\,\sinh\pars{{5\pi \over 8}\,\mu}\vec{b}\cdot\vec{\sigma}
\\[8mm] \mbox{and}\
\expo{\mu\,\mathsf{A}} & =
\expo{-3\pi\mu/8}\,\cosh\pars{{5\pi \over 8}\,\mu}\sigma_{0} +
{8 \over 5\pi}\,\expo{-3\pi\mu/8}\,
\sinh\pars{{5\pi \over 8}\,\mu}\vec{b}\cdot\vec{\sigma}
\\[4mm] & =
\half\,\exp\pars{{\pi \over 4}\mu}
\bracks{\sigma_{0} + {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}} +
\half\,\exp\pars{-\pi\mu}
\bracks{\sigma_{0} - {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}}
\end{align}

\begin{align}
A^{n} & = n!\bracks{\mu^{n}}\expo{\mu\,\mathsf{A}} =
\half\pars{\pi \over 4}^{n}\bracks{%
\sigma_{0} + {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}} +
\half\pars{-\pi}^{n}\bracks{%
\sigma_{0} - {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}}
\end{align}

\begin{align}
\color{#f00}{\sin\pars{A}} & = \sum_{n = 0}^{\infty}{\pars{-1}^{n} \over \pars{2n + 1}!}\,
A^{2n + 1} =
\half\sin\pars{\pi \over 4}\bracks{%
\sigma_{0} + {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}} +
\half\sin\pars{-\pi}\bracks{%
\sigma_{0} - {8 \over 5\pi}\,\vec{b}\cdot\vec{\sigma}}
\\[4mm] & =
\half\,{\root{2} \over 2}\bracks{\sigma_{0} + {8 \over 5\pi}\,\pars{A + {3\pi \over 8}\,\sigma_{0}}} =
{\root{2} \over 4}\ \underbrace{%
\bracks{{8 \over 5}\,\sigma_{0} + {8 \over 5\pi}\,A}}
_{\ds{{2 \over 5}
\pars{\begin{array}{cc}\ds{1} & \ds{2}\\ \ds{2} & \ds{4}\end{array}}}}
\\[3mm] & =
\color{#f00}{{1 \over 5}
\pars{\begin{array}{cc}\ds{1 \over \root{2}} & \ds{\root{2}}
\\[2mm]
\ds{\root{2}} & \ds{2\root{2}}
\end{array}}}
\end{align}
