Diagonalization and find matrix that corresponds to the given condition Diagonalize the matrix
$$
A=
\begin{pmatrix}
1 & 2\\
0 & 3
\end{pmatrix}
$$
and find $B^3=A$.
I derived $A \sim \text{diag}(1,3)$ but I have problem finding any $B$. I tried to solve it by writing $B= \begin{pmatrix} 1 & x\\ 0 & 3\end{pmatrix}$, but is it okay to solve the problem in this way?

The eigen values are $1,3 $ clearly. So it is diagonalizabe(distinct eigen values).
And so, there exits $P$ such that 
$$A=P\left(\begin{array}{cc}1& 0\\ 0& 3\end{array}\right)P^{-1}.$$
Now we need $B$ such that $B$ such that $B^3=A$
Supose there exists such a $B$ then, $$B^3=A=P\left(\begin{array}{cc}1& 0\\ 0& 3\end{array}\right)P^{-1}$$
Therefore, $$B=P\left(\begin{array}{cc}1& 0\\ 0& 3\end{array}\right)^{\frac 1 3}P^{-1}$$
$$=P\left(\begin{array}{cc}1^{\frac 1 3}& 0\\ 0& 3^{\frac 1 3}\end{array}\right)P^{-1}$$
