Let us assume that $u(x,t)=X(x) T(t)$
$u_{xx}=X''(x)T(t)$
$u_{t}=X(x)T'(t)$
Substituting we get ,
$$\frac{X''(x)}{X(x)}=\frac{T'(t)}{T(t)}=-\lambda$$
Now all the same dependence thing i am pretty sure you know it already. One term depend upon time, other only on Position etc.
We get two equations,
$X''(x)+\lambda X(x)=0$ and $\frac{T'(t)}{T(t)}=-\lambda$
Therefore solution is $X(x)=c_1\cos (\sqrt{\lambda}x)+c_2 \sin (\sqrt{\lambda}x)$
$T(t)=c_3e^{-\lambda t}$
Hence $u(x,t)=c_1\cos (\sqrt{\lambda}x)+c_2 \sin (\sqrt{\lambda}x)\times c_3e^{-\lambda t}$
Now given that $u(x,0)=\cos x =c_1c_3\cos (\sqrt{\lambda}x)+c_2c_3 \sin (\sqrt{\lambda}x) $
It is evident from this equation that only possible case for the constant $c_2=0$ otherwise sine terms will exist which is not possible.
Hence, $c_1c_3\cos (\sqrt{\lambda }x)=\cos x$
Let us transform this statement into the one given in our options.
Here for now so far we have figured the solution is not dependent on $\sin$
Hence (a) , (b) are not valid.
Moreover $b_n=0$ always since there is no phase.
$c_1c_3\cos (\sqrt{\lambda }x)=\cos x$ ,
Let use replace now safely $\sqrt{\lambda}=n$ in whole solution.
And let use replace $c_1c_3=a_n$ reason I will tell you later.
In our equation.
$a_n\times \cos nx = cos x$ .
Now what does this equation tell us? As you know with any other normal case. These kind of equation has usually infinite number of solution. Well so does thus one and we have to sum all of them. Or countable of them as per the desired solution.
But what will be the solution?
Let us take an example with $n=2$.
$a_2 \cos (2x)= \cos x $
Here $a_2$ is any constant having any value we desire it to have. Where as $cos 2x \neq \cos x$ , but we can make them equal by choosing a suitable constant or value $a_2$ such that they do become equal. Hence we can apply this reasoning for every other term. Therefore general solution is sum of all such term. I know my approach is not very rigorous , I'd love to see more rigorous approach by someone else.
Hence $u(x,t)=a_n \cos nx\times e^{-n^2 t}$
or $u(x,t)=\sum_{n=1}^{\infty}a_n \cos nx\times e^{-n^2 t} $ option (c)
But the fact is our solution might just be based on only the first term of our solution. Hence option(d)
Why not we take $a_0$ as well?
$a_0\cos 0= \cos x$
$a_0 = \cos x$ , whereas RHS is a variable , LHS is constant. Hence it can't be a valid solution.
Why is $a_1\neq 0$? I am pretty sure you can figure this out.
Why can some $a_n=0$? , the reasoning in this is harder. But it will take away the fun. Good luck :)
Why do we only consider the natural number, and not any other? Well the thing is, you are taking an infinite series of natural number. And eventually you will get enough information from all the constants $a_n$ and $cos n x$ that you won't be missing any information of your solution, i.e, your solution will be complete. Hence, we only need to consider $n \in N$ or it goes as per question.