Finding the matrix of multiplication by $\theta^2$, where $\theta^3 - 3\theta + 1 = 0$

This is a problem from a on-line source which yet comes with a solution (self-studier; not h.w.).

Let $E = \mathbb Q(\theta)$, where $\theta$ is a root of the irreducible polynomial $X^3 -3X + 1.$ I was wondering how one gets the matrix of the endomorphism $E \to E$ induced by multiplication by $\theta^2$.

I can see that $\theta^2 \cdot 1 = \theta^2$, $\theta^2 \cdot \theta = \theta^3 = 3\theta - 1$, and $\theta^2 \cdot \theta^2 = \theta \cdot \theta^3 = 3\theta^2 - \theta$.

This is where I fall apart. The solution gives the matrix \begin{bmatrix} 0&- 1&0 \\ 0&3&-1 \\ 1&0&3 \end{bmatrix}

I can that see if you multiply this by a $3 \times 1$ column vector of $1$'s, $4\theta^2$ + $2\theta$ $- 1$ emerges.

But I don't see how to derive the matrix; and, further, if it is unique. That is to say, if the $-1$ in the top row was in a different position in the top row, it seems you would still get $-1$ in the top position in the product.

Only a little of this is mine — except for the misstatements and confusion.

Thanks.

-
If your original polynomial is irreducible which I haven't checked, $(1,\theta,\theta^2)$ is a $\mathbb{Q}$-basis of $\mathbb{Q}(\theta)$, and your calculation tells you where multiplication by $\theta^2$ sends these basis vectors. – Olivier Bégassat Jun 21 '12 at 23:06
I edited the source a bit [I think you'll see that some things are easier to typeset than you had feared.] and tried to clarify some statements. – Dylan Moreland Jun 21 '12 at 23:37

Let's first check that $X^3 - 3X + 1$ is irreducible over $\mathbb Q$. Since it's a cubic, it's enough to show that it does not have a root in $\mathbb Q$. The rational root theorem tells you that the only possible roots in $\mathbb Q$ are $\pm 1$, and neither of these works.
Some general facts: if I have a field $F$ and an element $\alpha$ algebraic over $F$ with minimal polynomial $p(X)$ of degree $n$, then $\{1, \alpha, \ldots, \alpha^{n - 1}\}$ is a basis for $F(\alpha)$ over $F$. A proof should be in any reference, but it isn't so hard to come up with on your own: the relation $p(\alpha) = 0$ allows you to ignore higher powers of $\alpha$, and an honest linear dependence would give you a non-zero polynomial of degree $< n$ having $\alpha$ as a root, which is impossible.
The given matrix, as Olivier pointed out, is using exactly this sort of basis for both the source and target. And you've actually calculated the entries of this matrix — the second column, for example, gives the coefficients of $\theta^2 \cdot \theta = (-1) \cdot 1 + 3 \cdot\theta + 0 \cdot \theta^2$. Of course, if you use different bases then your matrix will change, but that is now a question of linear algebra.
@DylanMorelandThanks. I'm ok until the last paragraph. I'm assuming left multiplication by the matrix. And I understand what you are saying above about the basis. But in view of what you say regarding $\theta^2 \cdot \theta$, it looks like you are left multiplying the matrix by a $1$ x $3$ row matrix with the entries corresponding to the basis described? In short, this is the essence of my problem: I don't know how to organize the relations involving the products of $\theta^2$'s into the matrix and what the matrix multiplication looks like. – Andrew Jun 22 '12 at 0:54
@Andrew I'm only saying that in order to write down a matrix for a linear transformation you have to find the image of each element in the basis for the source and write that image in terms of the basis for the target. If you want to use the matrix find out where an element $\beta = a_0 + a_1\theta + a_2\theta^2$ goes, you multiply the matrix on the right by $\begin{pmatrix}a_0 \\ a_1 \\ a_2\end{pmatrix}$. The product is a $3 \times 1$ matrix $\begin{pmatrix}b_0 \\ b_1 \\ b_2\end{pmatrix}$, and then you'll know that $\theta^2\beta = b_0 + b_1\theta + b_2\theta^2$. Does that help at all? – Dylan Moreland Jun 22 '12 at 1:08