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?
No, in general $B$ will not be of that form.
Hint: you know $A = P^{-1}DP$. If $d_1$ and $d_2$ are the diagonal entries of $D$, let $E$ be a diagonal matrix with entries $d_1^{1/3},d_2^{1/3}$, and consider the matrix $P^{-1}EP$ (in particular, what do you get if you cube it?)