Showing that a subspace is invariant of a specific dimension. I'm studying for a qualifying exam in algebra and I'm slightly stuck on the following problem:

Let $\mathbb{F}$ be a field, and let $A$ be an $n\times n$ matrix over $\mathbb{F}$. Suppose that $p\in\mathbb{F}[x]$ is an irreducible polynomial of degree $d$ with $p(A)=O$, where $O$ is the zero linear operator on $\mathbb{F}^n$. For $x\in\mathbb{F}^n$, let $S(x)$ denote the span of the set $\{A^ix:i=0,1,\cdots,\}$.
(a) Show that if $x$ is nonzero, then $S(x)$ is an $A$-invariant subspace of dimension $d$.
(b) Prove that $d$ divides $n$.

I believe part (b) is straightforward: 
Because $p(A)=O$, $p$ is a multiple of the minimal polynomial of $A$. Because the characteristic polynomial of $A$ is also a multiple of the minimal polynomial of $A$, the degree $d$ of $p$ divides the degree of the characteristic polynomial of $A$. Since the characteristic polynomial of a matrix has degree equal to the dimension of the vector space, and $\operatorname{dim}(\mathbb{F}^n)=n$, the desired result follows. $\square$
For part (a), I think I can show invariance, but I'm stuck on dimension:
Note that $S(x)$ is $A$-invariant provided $As\in S(x)$ for all $s\in S(x)$. Equivalently, since $S(x)$ is the span of $\{A^ix:i=0,1,\cdots,\}$, then $S(x)$ is $A$-invariant provided $A(A^ix)\in S(x)$ for each $i=0,1,\cdots,$. Since $A(A^ix)=(AA^i)x=A^{i+1}x\in S(x)$, $S(x)$ is in fact $A$-invariant. $\square$

Thanks in advance for any help on showing the dimension of $S(x)$, and for any comments/critiques on what I have done already.
 A: Since we have $\deg p=d$ and $p(A)=0$, it follows straightforward that $A^d $ can be written in terms of $\mathrm{Id} , A, A^2 ,\dotsb ,A^{d-1} $.
A: EDIT. 
Of course, the @TheWildCat and the OP 's proofs cannot be correct because they do not use the fact that $p$ is irreducible....
For b). This exercise is essentially about the polynomials. 
I assume that the field $F$ is perfect (if $r\in F[x]$ is irreducible, then its roots in an algebraic extension are simple). cf. the comments below.
Clearly, $p\in F[x]$ is the minimal polynomial of $A$. On the other hand, $\chi_A\in F[x]$ -the characteristic polynomial of $A$- has degree $n$, is a multiple of $p$ and has (up to multiplicity), the same roots $(\lambda_i)_i$ as $p$ -in an algebraic extension $K$-.
The key is that if some $\lambda_i$ is a root of $q\in F[x]$, then $q$ is a multiple of $p$ (because it's irreducible). We deduce that the multiplicities of the $(\lambda_i)_i$, in $\chi_A$, are the same and, consequently, $\chi_A$ is a power of $p$; finally, $d$ divides $n$.
For a) (cf. also the @David C. Ullrich 's comment about this part).
Let $B=A_{|S(x)}$ where $x\not= 0$; clearly $\delta=dim(S(x))\leq d$; then, $s\in F[x]$, the minimal polynomial of $B$ (that is also the minimal polynomial of $x$) divides $\chi_A$ and has degree $\leq \delta$. Thus $s=p$ and $\delta=d$.
