Fractional derivative with linear algebra I have this question in linear algebra that asks us to represent $\frac{d}{dx}\sin x$ and $\frac{d}{dx}\cos x$ as a matrix in the basis of $\binom{1}{0}=\sin x, \ \binom{0}{1}=\cos x$ using eigenvectors and eigenvalues. So, I guessed $\left[\begin{matrix} 0 & -1 \\ 1 & 0 \end{matrix}\right]_B$,  s.t.
$$
\frac{d}{dx}\sin x=\left[\begin{matrix} 0 & -1 \\ 1 & 0 \end{matrix}\right]\cdot\binom{1}{0}=\binom{0}{1}=\cos x \\ 
\frac{d}{dx}\cos x=\left[\begin{matrix} 0 & -1 \\ 1 & 0 \end{matrix}\right]\cdot\binom{0}{1}=\binom{-1}{0}=-\sin x
$$
The question then asks me to do it for the square root of a derivative operator, like so $\sqrt{\frac{d}{dx}}$. So, I found the eigenvectors and values.$$
PDP^{-1}=\left[\begin{matrix} 1 & 1 \\ i & -i \end{matrix}\right]\cdot\left[\begin{matrix} i & 0 \\ 0 & -i \end{matrix}\right]\cdot\frac{1}{2}\left[\begin{matrix} 1 & i \\ 1 & -i \end{matrix}\right] \\
PD^{\frac{1}{2}}P^{-1}=\left[\begin{matrix} 1 & 1 \\ i & -i \end{matrix}\right]\cdot\left[\begin{matrix} i & 0 \\ 0 & -i \end{matrix}\right]^{\frac{1}{2}}\cdot\frac{1}{2}\left[\begin{matrix} 1 & i \\ 1 & -i \end{matrix}\right] \\
=\left[\begin{matrix} 1 & 1 \\ i & -i \end{matrix}\right]\cdot\left[\begin{matrix} e^{i\frac{\pi}{4}} & 0 \\ 0 & e^{-i\frac{\pi}{4}} \end{matrix}\right]\cdot\frac{1}{2}\left[\begin{matrix} 1 & i \\ 1 & -i \end{matrix}\right] \\
=\frac{1}{2}\left[\begin{matrix} 1 & 1 \\ i & -i \end{matrix}\right]\cdot\left[\begin{matrix} e^{i\frac{\pi}{4}} & ie^{i\frac{\pi}{4}} \\ e^{-i\frac{\pi}{4}}& -ie^{-i\frac{\pi}{4}}\end{matrix}\right] \\
=\frac{1}{2}\cdot\left[\begin{matrix}e^{i\frac{\pi}{4}}+e^{-i\frac{\pi}{4}} & i(e^{i\frac{\pi}{4}}-e^{-i\frac{\pi}{4}}) \\ i(e^{i\frac{\pi}{4}}-e^{-i\frac{\pi}{4}}) & i^2(e^{i\frac{\pi}{4}}+e^{-i\frac{\pi}{4}})\end{matrix}\right] \\
=\frac{1}{2}\cdot2\cdot\left[\begin{matrix} \cos{\frac{\pi}{4}} & -\sin{\frac{\pi}{4}} \\ -\sin{\frac{\pi}{4}} & -\cos{\frac{\pi}{4}}\end{matrix}\right] \\
=\frac{1}{\sqrt{2}}\cdot\left[\begin{matrix}1 & -1 \\ -1 & -1\end{matrix}\right]
$$
However, when I tested $\sin x$, I got:$$
\frac{1}{\sqrt{2}}\cdot\left[\begin{matrix}1 & -1 \\ -1 & -1\end{matrix}\right]\cdot\binom{1}{0}=\frac{1}{\sqrt{2}}\cdot\binom{1}{-1} \\ 
\frac{1}{\sqrt{2}}\cdot\left[\begin{matrix}1 & -1 \\ -1 & -1\end{matrix}\right]\cdot\frac{1}{\sqrt{2}}\cdot\binom{1}{-1}=\binom{1}{0}=\sin x
$$ which is a weird result because I expected $\cos x$. I redid my working again and got the same result.  What did I do wrong here? Could someone help me find that error please? Thank you very much for your help.
 A: Your calculation is very wrong. E.g. $P^{-1}$ is not $\frac12\pmatrix{1&i\\ 1&-i}$ but $\frac12\pmatrix{1&-i\\ 1&i}$ and the eigendecomposition of your matrix isn't $P\pmatrix{i\\ &-i}P^{-1}$ but $P\pmatrix{-i\\ &i}P^{-1}$.
A: I try to follow the same approach in Octave, using "eig" and "sqrtm" functions for eigenvalue decomposition and matrix square root and I get
$$D^{1/2} = \frac 1 {\sqrt 2} \begin{bmatrix}1&-1\\1&1\end{bmatrix}$$
We can verify:
$$\left(\frac 1 {\sqrt 2} \begin{bmatrix}1&-1\\1&1\end{bmatrix}\right)^2= D$$
I would guess there is some arithmetic error you have done because the idea is sound.
Remember we can likely choose different branches of square root function on the eigenvalues and get different operators.
Choosing another branch of square root gives us $$\frac{i}{\sqrt{2}} \begin{bmatrix} 1&1\\-1&1\end{bmatrix}$$ for example.
A: The decomposition of $\left[ \begin{array}{cc}
0&-1\\
1&0
\end{array}
\right]$ is wrong. Actually we have
$$\left[ \begin{array}{cc}
0&-1\\
1&0
\end{array}
\right]=(\frac{1}{\sqrt{2}}\left[ \begin{array}{cc}
1&-1\\
1&1
\end{array}
\right])^2$$
