Matrices with eigenvalues 0 and 1 How can you describe all $2\times 2$ matrices whose eigenvalues are 0 and 1?
My attempt: 
I know that 0 and 1 has to be solutions of the characteristic polynomial. And I've considered some examples like $$\begin{pmatrix}0&0\\0&1\end{pmatrix},\begin{pmatrix}1&0\\0&0\end{pmatrix} \text{ etc.}$$but I haven't found any regularity. But I also know from linear algebra that a matrix $A$ satisfying $A^2=A$ has only eigenvalues 0 and/or 1. Are there any more matrices? What do they have to satisfy?
 A: Since the eigenvalues are 0 and 1 (hence distinct), the matrix must be diagonalizable.  Thus it must be of the form $P^{-1}\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}P$ for some invertible matrix $P$.  Since there is a nice explicit formula for the inverse of a $2 \times 2$ matrix, you can work out the form of any matrix of the aforementioned form.  Take $P = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$, where $\det P = ad-bc \ne 0$, then write out $P^{-1}$, and then compute.
EDIT: I am assuming you mean that the set of eignevalues of your matrix must be $\{0,1\}$, as opposed to being contained in this set, which is what Sharkos assumes.  So it depends on what you intended.
A: Assuming that we exclude matrices from having complex eigenvalues but no real eigenvalues (which seems reasonable given your question) we make use of the Jordan normal form of the matrix.
There is some invertible matrix $P$ (a change of basis) such that
$$A = P^{-1} J P$$
where $J$ is in Jordan normal form with either $0$ or $1$ on the diagonal. In particular,
$$J = \pmatrix{0 & 0 \\ 0 & 0}, \pmatrix{1 & 0 \\ 0 & 1}, \pmatrix{1 & 0 \\ 0 & 0}, \pmatrix{0 & 1 \\ 0 & 0}, \pmatrix{1 & 1 \\ 0 & 1}$$
generate all other forms of these matrices.


*

*The first case has $A=0$.

*The second case has $A=I$.

*The third case is a change-of-basis from having one of each eigenvalue; it is a projection onto a line.

*The fourth case is a nilpotent matrix such that $A^2=0$. It maps one direction into another, and that direction into oblivion.

*The fifth case generates a skew/shear in some direction.

A: This is a partial answer that suggests how to parametrize such matrices explicitly.  
The other answers are more elegant and tell the story more succinctly, but they construct the answers non-uniquely.  (There are different matrices that you can conjugate a given Jordan normal form by and still obtain the same matrices:  $P^{-1} J P = Q^{-1} J Q$ is possible with $P \ne Q$.)

First a little result about the characteristic polynomial $p_A(\lambda) = \det(A - \lambda I)$ for a $2 \times 2$ matrix $A$:
$$
p_A(\lambda) = \lambda^2 - (\operatorname{tr} A) \lambda + \det A,
$$
where $\operatorname{tr} A = a + d$ is the trace.  Check this from the definition if you're not familiar with it.
Now, proceed by cases.  Suppose that $\lambda = 1$ is the only eigenvalue.  Then,
$$
p_A(\lambda) = (\lambda - 1)^2 = \lambda^2 - 2\lambda + 1.
$$
So, we know that
$$
\left\{
\begin{align}
\operatorname{tr} A &= 2 \\
\det A &= 1
\end{align}
\right.
$$
With
$$
A = \begin{bmatrix} a & b \\ c & d \end{bmatrix},
$$
$$
\left\{
\begin{align}
a + d &= 2 \\
ad - bc &= 1
\end{align}
\right..
$$
Taking advantage of the trace equation to reduce the number of parameters, let's make the substitution $a = 1 + t$ and $d = 1 - t$.  Now the determinant equation becomes $(1 + t)(1 - t) - bc = 1$ or
$$
bc = t^2.
$$
Either $b = 0$, in which case, $t = 0$, as well, and $c$ is free to take any value:
$$
\begin{bmatrix} 1 & 0 \\ c & 1 \end{bmatrix}.
$$
Or $b \ne 0$, so $c = -\frac{t^2}{b}$, so we have:
$$
\begin{bmatrix} 1 + t & b \\ -\tfrac{t^2}{b} & 1 + t \end{bmatrix}.
$$
The space of possibilities in $(b, c)$-plane consists of both axes (corresponding to having $t = 0$, hence $1$ on the diagonal) together with the second and fourth quadrants (corresponding to $t \ne 0)$.

A similar analysis can give an explicit description of the other cases for the possibilities of the eigenvalues.  (Note that this idea generalizes beyond your $\lambda \in \{0, 1\}$ assumption.)
A: Consider a matrix
$$
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
$$
You can easily work out the characteristic polynomial, which is
$$
X^2 - (a+d)X + (ad-bc)
$$
Based on your information, you have
$$
\begin{cases}
a+d=1 \\
ad-bc=0
\end{cases}
$$
because in a polynomial $X^2+pX+q$ the sum of the roots is $-p$ and their product is $q$.
This gives $d=1-a$, so $a-a^2-bc=0$ or $bc=a-a^2$. You can thus choose arbitrarily $a$. If $a=0$ or $a=1$, then one among $b$ and $c$ must be zero and the other one is arbitrary. For $a-a^2\ne0$, the matrices you look for have the form
$$
\begin{bmatrix}
a & b \\
\dfrac{a-a^2}{b} & 1-a
\end{bmatrix}
$$
So the general form is one of these five cases


*

*$\begin{bmatrix}0 & b \\ 0 & 1\end{bmatrix}\quad$ (arbitrary $b$)

*$\begin{bmatrix}0 & 0 \\ c & 1\end{bmatrix}\quad$ (arbitrary $c$)

*$\begin{bmatrix}1 & b \\ 0 & 0\end{bmatrix}\quad$ (arbitrary $b$)

*$\begin{bmatrix}1 & 0 \\ c & 0\end{bmatrix}\quad$ (arbitrary $c$)

*$\begin{bmatrix}
a & b \\
\dfrac{a-a^2}{b} & 1-a
\end{bmatrix}\quad$ ($a\ne0$, $a\ne1$, $b\ne0$)
A: If a matrix $A\in\mathbb{C}^{n\times n}$ has only eigenvalues $0$
and $1$ then its characteristic polynomial is of the form 
$$
z^{a}\left(z-1\right)^{b}=z^{a}\sum_{k=0}^{b}\left(\begin{array}{c}
b\\
k
\end{array}\right)z^{k}\left(-1\right)^{n-k}=\sum_{k=0}^{b}\left(\begin{array}{c}
b\\
k
\end{array}\right)z^{a+k}\left(-1\right)^{n-k}
$$
 with $a+b=n$. A matrix that has the above characteristic polynomial
is
$$
B=\left[\begin{array}{cccccc}
0 &  &  &  &  & -c_{0}\\
1 & 0 &  &  &  & -c_{1}\\
 & 1 & 0 &  &  & -c_{2}\\
 &  & 1 & \ddots &  & \vdots\\
 &  &  & \ddots & 0 & -c_{n-2}\\
 &  &  &  & 1 & -c_{n-1}
\end{array}\right]
$$
where
$$
c_{j}=\begin{cases}
0 & j<a\\
\left(\begin{array}{c}
b\\
k
\end{array}\right)\left(-1\right)^{n-k} & j\geq a
\end{cases}.
$$
The above is called the Frobenius companion matrix to the characteristic
polynomial. Another matrix that will satisfy this is $B^{T}$ since
$\det\left(X^{T}\right)=\det\left(X\right)$. Note that $B$ is not a projection (i.e. $B^2\neq B$).
Obviously, not all matrices
that have only eigenvalues of $0$ and $1$ are of this form. For
example, $I$ only has $1$ as an eigenvalue but cannot be written
in the above form.
