Solution: To find a matrix $P$ such that $P^{-1}AP$ is a diagonal matrix, we can use the following steps:
As the matrix $A$ is an upper triangular matrix, so the eigenvalues will be its diagonal entries, i.e., $1,2$, and $3$.
Now we will find out the eigenvector associated to each eigenvalue.
$\lambda =1$.
Then we have $(A-I) \mathbf{v}_1 = 0$, so
\begin{align*}
&
\begin{bmatrix}
0 & 1 & 0 \\
0 & 1 & 3 \\
0 & 0 & 2 \\
\end{bmatrix}
\mathbf{v}_1 =
\begin{bmatrix}
0 \\
0 \\
0 \\
\end{bmatrix}.
\end{align*}
A non-zero solution will be $\mathbf{v}_1 = \begin{bmatrix} 1 & -1 & 0\end{bmatrix}^t$, which is the eigenvector associated with eigenvalue 1.
$\lambda =2$.
Then we have $(A-2I) \mathbf{v}_2 = 0$, so
\begin{align*}
&
\begin{bmatrix}
-1 & 1 & 0 \\
0 & 0 & 3 \\
0 & 0 & 1 \\
\end{bmatrix}
\mathbf{v}_2 =
\begin{bmatrix}
0 \\
0 \\
0 \\
\end{bmatrix}.
\end{align*}
A non-zero solution will be $\mathbf{v}_2 = \begin{bmatrix} 1 & 0 & 0\end{bmatrix}^t$, which is the eigenvector associated with eigenvalue 2.
$\lambda =3$.
Then we have $(A-2I) \mathbf{v}_3 = 0$, so
\begin{align*}
&
\begin{bmatrix}
-2 & 1 & 0 \\
0 & -1 & 3 \\
0 & 0 & 0 \\
\end{bmatrix}
\begin{bmatrix}
v_{31} \\
v_{32} \\
v_{33} \\
\end{bmatrix} =
\begin{bmatrix}
0 \\
0 \\
0 \\
\end{bmatrix} \\
\implies & -2v_{31}+v_{32} = 0, ~ -v_{32}+3v_{33} = 0\\
\implies & v_{32} = 2v_{31}, ~ v_{33} = \frac{1}{3}v_{32} = \frac{2}{3}v_{31}
\end{align*}
A non-zero solution will be $\mathbf{v}_3 = \begin{bmatrix} 3 & 6 & 2\end{bmatrix}^t$, which is the eigenvector associated with eigenvalue 3.
Thus, the required matrix $P$ will be \[ P = \begin{bmatrix} 1 & 1 & 3 \\ 0 & 1 & 6 \\ 0 & 0 & 2 \\ \end{bmatrix}. \] Now we can see that \[ P^{-1}AP = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \\ \end{bmatrix}. \]