Dimension of the subspace of the polynomial ring over $\mathbb R$ 

Suppose $P_n =\{ f(x) \in \mathbb R[x] : \deg(f(x)) \leq n\}$ and $W = \{ p(x) \in P_n : p(x) = p(1-x) \}$. Find the dimension of subspace $W$. 


Firstly I am showing that $W$ is a subspace of $P_n$. Suppose $a,b \in \mathbb R$ and $p, p' \in P_n$, then $p(x)  = p(1-x)$ and $p'(x) = p'(1-x)$ . Now $(ap +bp')(x) = ap(x) + bp'(x) = ap(1-x) + bp'(1-x) = (ap +bp')(1-x)$. Thus $W$ is a subspace of $P_n$.
Clearly $1 \in W$, so $\mathbb R \subset W$, let if possible one degree polynomial  $ax +b \in W$, then $ax + b = a(1-x) +b$ $\Rightarrow x = 1/2$, thus one degree polynomial does not belongs to $W$.
if $ax^2 + bx +c  \in W$, then $ax^2 + bx + c = a(1-x)^2 + b(1-x) +c$, we get $a=-b$
Similar if $ax^3 + bx^2 + cx + d \in W$, we got $a = 0$ , which is not possible.
we find that odd degree polynomial does not belong to $W$. Thus the Dimension of $W$ is $\frac{n}{2}$ if $n$ is even and $\frac{n+1}{2}$ if $n$ is odd.
I would be thankful if someone check my solution.
 A: Let $X=\{p(x)\in P_n:p(x)=p(-x)\}$, and let $p(x)\in X$.
If we write $p(x)=a_0+a_1x+\cdots+a_nx^n$ for some scalars 
$a_0,a_1,\cdots,a_n\in\mathbb{R}$, then we have
\begin{align}
&\left\{\begin{array}{ll}
a_1x+a_3x^3+\cdots+a_nx^n=0&\mbox{if }n\mbox{ is odd};\\
a_1x+a_3x^3+\cdots+a_{n-1}x^{n-1}=0&\mbox{if }n\mbox{ is even}.
\end{array}\right.\\[10pt]
\Longrightarrow\quad
&\left\{\begin{array}{ll}
a_1=a_3=\cdots=a_n=0&\mbox{if }n\mbox{ is odd};\\
a_1=a_3=\cdots=a_{n-1}=0&\mbox{if }n\mbox{ is even}.
\end{array}\right.\\[10pt]
\Longrightarrow\quad&\dim(X)=
\left\{\begin{array}{ll}
\frac{n+1}{2}&\mbox{if }n\mbox{ is odd};\\
\frac{n}{2}+1&\mbox{if }n\mbox{ is even}.
\end{array}\right.
\end{align}
Finally, consider the linear map $T:X\rightarrow W$ by $T(p)(x)=p\left(x-\frac{1}{2}\right)$.
Since $T$ is an isomorphism, we conclude that $W=T(X)$  has the same dimension as $X$.
A: Any polynomial $p(x)$ of degree $\le n$ can be expressed as a linear combination of polynomials of the shape $\left(x-\frac{1}{2}\right)^i$, where $0\le i\le n$. One way to see this is to write down the Taylor expansion of $p(x)$ about $x=\frac{1}{2}$. This collection of polynomials is a linearly independent set, so it is a basis for $P_n$.
Note that if $g(x)=x-\frac{1}{2}$, then $g(1-x)=1-x-\frac{1}{2}=\frac{1}{2}-x$, so $g^2(x)=g^2(1-x)$. 
It follows that $\left(\frac{1}{2}-x\right)^{2k}$ is in $W$ for any $k$ such that $2k\le n$. It is clear that these are linearly independent. 
One can show that if $i$ is odd, then $\left(x-\frac{1}{2}\right)^i$ is not in $W$, by an argument like the one you outlined. It follows that the $\left(x-\frac{1}{2}\right)^{2k}$ form a basis for $W$, and the dimension result follows.  The dimension of $W$ is $1+n/2$ if $n$ is even, and $(n+1)/2$ if $n$ is odd.
