I know there are some posts about this, but I'm still confused regarding this specific question. It is said that the dimension of any field extension $\mathbb{Q}(w)$ is the degree of the irreducible polynomial of $w$.
Now for $w=\sqrt{5+\sqrt{2}}$, the irreducible polynomial is $$p(x)=x^4-10x^2+23$$ which has roots $$\pm \sqrt{5+\sqrt{2}}, \pm \sqrt{5-\sqrt{2}}$$ and evidently only $\sqrt{5+\sqrt{2}}, \sqrt{5-\sqrt{2}}$ are linearly independent. Thus as a first guess a basis could be $$\left\{1,\sqrt{5+\sqrt{2}}, \sqrt{5-\sqrt{2}}\right\} \,,$$ which has only 3 elements however.
Since we must have $$\sqrt{5+\sqrt{2}}^2 = 5+\sqrt{2} \in \mathbb{Q}(w) \, $$ we can pick $\sqrt{2}$ as another basis vector. Additionally $$\sqrt{5+\sqrt{2}} \cdot \sqrt{5-\sqrt{2}}=\sqrt{23} \in \mathbb{Q}(w) \, ,$$ so $\sqrt{23}$ is another basis vector? But that would mean I have 5 basis vectors and not 4?
What am I thinking wrong? May I be confused in considering all roots of $p$? So actually my basis would just be $$\left\{ 1 , \sqrt{5+\sqrt{2}} , \sqrt{2} , \sqrt{2}\sqrt{5+\sqrt{2}} \right\} \, ?$$
If so, then the other roots really have nothing to do with the dimension of $\mathbb{Q}(w)$, so how come the degree of $p(x)$ gives the dimension of the space?
What is the dimension of the splitting field $\mathbb{Q}(p(x))$? As the analysis above shows, it must be at least 5. In fact, continuing from the newly found basis $$\left\{1,\sqrt{5\pm\sqrt{2}},\sqrt{2},\sqrt{23}\right\} \, ,$$ we can construct new basis vectors by suitable combinations. This way we find $$\sqrt{2}\sqrt{23},\sqrt{2}\sqrt{5\pm \sqrt{2}},\sqrt{23}\sqrt{5\pm\sqrt{2}},\sqrt{2}\sqrt{23}\sqrt{5\pm\sqrt{2}} \in \mathbb{Q}(p(x)) \, ,$$ so our dimension would be 12. Is that correct?
Is there a general formula for the dimension of the latter consideration?
Furthermore, I now consider $\mathbb{Q}(v,w)$, where $v$ is a root of $p(x)$ and $w$ a root of $q(x)$. How do I know that every element of $\mathbb{Q}(v,w)$ is actually a root of a polynomial over $\mathbb{Q}[x]$?
The field extension $\mathbb{Q}(\omega)$ is, by definition, the smallest field containing $\mathbb{Q}$ and $\omega$, not $\mathbb{Q}$ plus all roots of $p(x).$ The latter is called the splitting field of $p(x).$
An irreducible polynomial of degree $4$ has FOUR roots (in an algebraic closure), but FOUR is also the number of monomial of degree strictly smaller than $4$ is $4:$
The field extension $\mathbb{Q}(\omega)$ is isomorphic, as rings, to $\mathbb{Q}[x]/(p(x)),$ where $p(x)$ is the monic irreducible polynomial satisfied by $\omega.$ The isomorphism fixes $\mathbb{Q}$ and maps $\omega$ to $x.$
Elements of the latter field can be represented by polynomials modulo $(p(x)),$ i.e. things of the form $\sum_i a_i x^i$ and things being equal when their difference is a multiple of $p(x).$
Now one notes that $ x^4 = 10 x^2 -23,$ $x^5 =x(10x^2-23)$ an so on i.e. $x^i$ for $i>3$ can be represented by linear combinations of $\{1,x,x^2,x^3\}.$ This suggest that a basis is of $\mathbb{Q}[x]/(p(x))$ is $\{1,x,x^2,x^3\}.$
One needs to show that it is linearly independent over $\mathbb{Q}$: If note, then there are $a,b,c,d \in \mathbb{Q}$ such that
$a+bx + cx^2 + dx^3 =0$, the LHS is a degree three polynomial equal to $0$ in $\mathbb{Q}[x]/(p(x)),$ so it must be a multiple of $p(x),$ which is a degree $4$ polynomial, hence it must be $0$.
The isomorphism then gives you a basis for $\mathbb{Q}(\omega)$, namely, $\{1,\omega,\omega^2, \omega^3\}.$ THUS 4 is the dimension.
What you have shown by your computation is that not all roots of $p(x)$ belong to the field. Not because that would imply that the extension is of odd degree but because it would contain $\sqrt 2$ $\sqrt 23, \sqrt{5 + \sqrt 2}$ which can not all co-exist in a degree $4$ extension of $\mathbb{Q}.$
The set $\left\{ 1 , \sqrt{5+\sqrt{2}} , \sqrt{2} , \sqrt{2}\sqrt{5+\sqrt{2}} \right\} \,$ is a basis but it's not the easiest one.
To find the degree of the splitting field note that $ \sqrt 2$ is in $\mathbb{Q}(\omega),$ and so $p(x)$ factors as $$ (x^2- (5+\sqrt 2) ) ( x^2- (5-\sqrt 2 )),$$ over $\mathbb{Q}(\omega).$ The latter factor is irreducible (otherwise all roots will be in the field). Now you need to consider $L:=\mathbb{Q}(\omega)[x] /( x^2- (5-\sqrt 2 )$ which is a degree 2 extension of $\mathbb{Q}(\omega),$ by the above. By the tower lemma $$[L:\mathbb{Q}]= [L:\mathbb{Q}(\omega)]\cdot [\mathbb{Q}(\omega):\mathbb{Q}] = 2 \cdot 4 = 8.$$ Thus the degree is 8, not 12.
For question 3, any field extension $L/\mathbb{Q}$ of finite degree, so even more generally. Let $ \alpha \in L,$ since $L$ is finite dimensional over $\mathbb{Q},$ say of degree d, the set $\{1, \alpha,... \alpha^{d}\},$ which is a set of $d+1$ vectors, is linearly dependent i.e. there is $a_i \in \mathbb{Q}$ not all zero such that $$ \sum_{i=0}^d a_i \alpha^{i} = 0.$$ If you call $A(x)= \sum_{i=0}^d a_i x^{i}$, then $A(\alpha) =0.$