<s>[INST] Get matrix $A^{n}$ problem with eigenvalues and eigenvectors i have problem with some matrix
$A = \begin{bmatrix}
  \frac{1}{2} & 0 \\
         2    & \frac{1}{2}
  \end{bmatrix}$
To get $A^{n} = P J^{n} P^{-1}$
$\begin{bmatrix}
  \frac{1}{2} - \lambda & 0 \\
         2    & \frac{1}{2} - \lambda
  \end{bmatrix}$
$J^{n} =\begin{bmatrix}
  (\frac{1}{2})^{n} & n(\frac{1}{2})^{n-1} \\
         0    & (\frac{1}{2})^{n}
  \end{bmatrix}$
i'm not sure how to create this matrix
So the eigenvaues are $\lambda_{1} = \lambda_{2} = \frac{1}{2}$
then 
$\begin{bmatrix}
  0 & 0 \\
   2    & 0\\
  \end{bmatrix}$
$\begin{bmatrix}
  x\\
  y\\
  \end{bmatrix}$ =
$\begin{bmatrix}
  0\\
  0\\
  \end{bmatrix}$
The eigenvector are : $\begin{bmatrix}
  x\\
  0\\
  \end{bmatrix}$
The question is: How look like $P$ matrix?
edit: So the answer will be:
$A^{n} =\begin{bmatrix}
  0 & \frac{1}{2}\\
  1 & 1\\
  \end{bmatrix}$
$\begin{bmatrix}
  (\frac{1}{2})^{n} & n(\frac{1}{2})^{n-1} \\
         0    & (\frac{1}{2})^{n}
  \end{bmatrix}$
$\begin{bmatrix}
  -2 & 1\\
  2 & 0\\
  \end{bmatrix}$
Is that right?
 [/INST] The eigenvalues are indeed $\lambda_1 = \lambda_2 = \lambda =\frac 12$. The matrix $P$ contains as its columns the right hand (generalized) eigenvectors of $A$, which are linearly independent. Solving the system $$(A- \lambda I) \mathbf{v} =\mathbf 0\iff \begin{bmatrix} 0 &0 \\ 2 & 0 \end{bmatrix}\cdot \begin{bmatrix} x \\ y\end{bmatrix} = \begin{bmatrix} 0 \\ 0\end{bmatrix}$$ yields that $x = 0$ and $y \in \mathbb R^*$ (since the zero vector cannot be an eigenvector).Thus, we can consider the eigenvector $\mathbf{v} = \begin{bmatrix} 0\\1\end{bmatrix}.$ 
Due to $\dim V_{\lambda} = 1,$ in order to define matrix $P$ we need to find a generalized eigenvector  $\mathbf w$ of rank $2$, such that $$\left(A-\frac 12 I\right)^2\mathbf w = \mathbf 0\\[2ex]
\text {and} \\[2ex]
\left(A- \frac 12 I\right)\mathbf w \neq \mathbf 0.$$ For that reason we define the vector $\mathbf w $ as the solution of the system $$\left(A- \frac 12 I\right) \mathbf w = \mathbf v.$$
That means we have to solve the linear system $$\begin{bmatrix} 0 & 0 \\2 & 0 \end{bmatrix} \cdot\begin{bmatrix} w_1 \\ w_2 \end{bmatrix} =\begin{bmatrix}0 \\ 1\end{bmatrix}.$$ 
The matrix $P$ is equal to $P  = \begin{bmatrix} 0 & w_1 \\ 1 & w_2 \end{bmatrix}$. Can you fill in the details?
</s>