Find value of k for distinct eigenvalues Consider the matrix
$$
A =
\left( \begin{array}{ccc}
0 & 1 & 0 \\
0 & 0 & 1 \\
k & 3 & 0 \end{array} \right)
$$
where k is an arbitrary constant. For which values of k does A have three distinct real eigenvalues? For which k does A have two distinct eigenvalues? 
Hint: Graph the function 
$$
g(\lambda) = \lambda^3 - 3\lambda
$$
Find its local maxima and minima.
So far I've tried this:
Let
$$
B = A - \lambda * I = 
\left( \begin{array}{ccc}
-\lambda & 1 & 0 \\
0 & -\lambda & 1 \\
k & 3 & -\lambda \end{array} \right)
$$
where I is the identity matrix.
Then: 
$$
p(\lambda) = det(B) = -\lambda^3 + 3\lambda + k
$$
Then I found the critical points by setting the derivative to 0.
$$
p'(\lambda) = -3\lambda^2 + 3 = 0 \\
\lambda = 1 \\
\lambda = -1 
$$
Plugging this back into the original equation I got
$$
p(1) = -1^3 + 3(1) + k > 0 \\
p(-1) = 1^3 + 3(-1) + k < 0 \\
$$
This gave me the values of k
$$
k > -2 \\
k < 2
$$
This is only one set of values for k. Is the value of k such that there are three distinct real eigenvalues or two? Also, if this is correct, how do I find the other set of values for k? And finally, did I missing something since the hint gave me an equation that I didn't find. I'm not really sure where that equation came from.
Edit: I realize where that equation that's given in the hint came from. I didn't realize it was the characteristic polynomial that I calculated but just in a different form.
 A: By plotting $p(\lambda)$ for the case where $k = 0$, we obtain the following curve:

By varying $k$, we are free to move the curve up or down. Now recall that having three distinct real eigenvalues corresponds to making $p(\lambda)$ cross the horizontal axis exactly three times. By computing the local extrema, notice that this can happen by vertically translating up by no more than $2$ units or vertically translating down by no more than $2$ units. So $k \in (-2, 2)$ corresponds to three distinct real eigenvalues and $k \in \{-2, 2\}$ corresponds to two distinct real eigenvalues and $k \in (-\infty, -2) \cup (2, \infty)$ corresponds to one real eigenvalue.
A: the characteristic equation is $$3\lambda - \lambda^3 = k.$$ the graph has a local max  $(1,2)$ and local min at $(-1-2).$ 
so if $$ -2 < k < 2, \text{the char equation has three distinct roots}\\
 k = \pm 2, \text{the char equation has a repeated real root}\\
|k| >2 \text{char equation has one real root and two complex conjugate roots.}$$
