How to show that no nontrivial solution of $y''+(1-x^2)y=0$ vanishes infinitely often? 
How to show that no nontrivial solution of $y''+(1-x^2)y=0$ vanishes infinitely often?

From the theorem we have $y''+q(x)y=0$ has at most one solution if $q(x)<0$. So in our case $q(x)=(1-x^2)$, so when $|x|>1$, we get finitely many solutions.
But when $|x|<1$, we have $q(x)>0$. I don't understand how to conclude.
When $|x|=1$, $q(x)=0$. We know that $y''=0$ has infintely many solutions i.e. any constant and $x$.
Can someone please clear my doubt when $|x|\geq1$ as I am getting ambiguous answer.
Any help is appreciated. I had gone through this solution https://math.stackexchange.com/a/3092565/715501
but couldn't understand.
 A: Let $y\colon\Bbb R\to\Bbb R$ be  differentiable. Let 
$$A=\{\,x\in\Bbb R \mid y(x)\ne 0\,\}$$
and
$$B=\{\,x\in\Bbb R\mid y(x)=y'(x)=0\,\}.$$
Clearly, $A\cap B=\emptyset$.
If $a\in A$ and $b\in B$, then $[\frac{a+b}2,b)$ (resp. $(b,\frac{a+b}2]$) either contains a point $\in A$ or completely belongs to $B$. Hence in any interval containing both point from $A$ and points from $B$, we can find such points with arbitrarily small distance.
From now on,  let $y$ be a non-trivial solution of 
$$\tag0 y''+q(x)y=0$$
(so $A\ne\emptyset$) where $q$ is continuous. 
Claim 1. $B=\emptyset$.
Proof. Assume otherwise. Then we find a compact interval $I$ with $I\cap A$ and $I\cap B$ both non-empty. Let $M=\max_{x\in I}|q(x)|$. Then $M>0$ and we can let $r:=\frac1{\sqrt{2 M}}$. As seen above, there exist $a_0\in A\cap I$, $b\in B\cap I$ with $|a_0-b|<r$. By the Mean Value Theorem, we find $c$ between $a_0$ and $b$ with $|y'(c)|>\frac{|y(a_0)|}r$ and then $a_1$ between $c$ and $b$ with $|y''(a_1)|>\frac{|y(a_0)|}{r^2}$.
By $(0)$, we have $q(a_1)\ne 0$ and
$$|y(a_1)|=\frac{|y''(a_1)|}{q(a_1)|}>\frac{|y(a_0)|}{|q(a_1)|r^2}\ge 2|y(a_0)|. $$
As $a_1\in A\cap I$ and $|a_1-b|<r$, we can repeat the process and obtain a sequence $\{a_k\}_k$ with $a_k\in I\cap A$ and $|y(a_0)|\le 2^{-k}|y(a_k)|\le 2^{-k}M$, contradiction. $\square$
Claim 2. $A^\complement$ is closed and discrete.
Proof. By continuity of $y$, $A^\complement$ is closed. Assume $x_0\in \Bbb R$ and for all $r>0$, $(x_0-r,x_0+r)\setminus\{x_0\}$ contains a point $\in A^\complement$. By closedness, also $x_0\in A^\complement$. Then  by Rolle, each $(x_0-r,x_0+r)\setminus\{x_0\}$ contains a point where $y'$ vanishes. By continuity of $y'$, $y'(x_0)=0$ and so $y_0\in B$, contradicting claim 1. $\square$
Claim 3. Let $x_1<x_2$ be zeroes of $y$. Then there exists $x\in(x_1,x_2)$ with $q(x)\ge 0$.
Proof.
Let $x_\max$ be a maximizer of $y$ on $[x_1,x_2]$. Unless $x_\max\in\{x_1,x_2\}$, this implies $y'(x_\max)=0$ and $y''(x_\max)\le 0$. By claim 1, $y(x_\max)\ne 0$ and as we have a maximizer, clearly $y(x_\max)>0$ so that by $(0)$, $q(x_\max)\ge0$, as desired. The same argument work with a minimizer $x_\min$.
Remains the case that $x_\min,x_\max\in\{x_1,x_2\}$. But then $y(x)=0$ for all $x\in[x_1,x_2]$, contradicting claim 2$. $\square$
Finally. Assume additionally that $q(x)<0$ for all $x$ with $|x|>L$. Then $y$ has only finitely many zeroes.
Proof.  By claim 3, there is at most one zero in $(L,\infty)$, at most one zero in $(-\infty,-L)$, and by claim 2, there are at most finitely many in the compact interval $[-L,L]$. $\square$
A: As you have found out, the claim is true, any solution only has a finite number of solutions. The Sturm-Picone comparison theorem tells you that because of $1-x^2\le 1$ any solution has at most as many solutions as any solution of $y''+y=0$ on $[0,1]$, that is, at most one. This gives at most two solutions on $[0,\infty)$.
Alternatively, you could have argued that on any bounded interval there can only be finitely many zeros, else you get a double root at any limit point of the root set inside this interval. This is impossible for a non-trivial solution, as zero initial conditions give the zero solution.
Some solutions

When one changes the minus sign into a plus sign, the same theorem gives the opposite of the claim, any solution of $y''+(1+x^2)y=0$ has infinitely many roots.

A: Why not to solve the DE? From the DE structure we propose as solution
$$
y_p = a e^{b x^2}
$$
and after substitution we have
$$
a (2 b+1) e^{b x^2} \left((2 b-1) x^2+1\right)=0
$$
so making $b = -\frac 12$ we have that $y_p = a e^{-\frac {x^2}{2}}$ is a particular solution.  Now proposing as a more general solution $y_p = a(x)e^{-\frac {x^2}{2}}$ after substitution we get
$$
e^{-\frac{x^2}{2}} \left(a''(x)-2 x a'(x)\right) = 0
$$
which is true for 
$$
a''(x)-2 x a'(x)=0
$$
now calling $b(x) = a'(x)$ we follow with
$$
b'(x)-2 x b(x)=0
$$
which is separable, with solution
$$
b(x) = C_0 e^{x^2}\Rightarrow a(x) = \frac{1}{2} \sqrt{\pi } C_0 \text{erfi}(x)+C_1
$$
and finally
$$
y = \left(\frac{1}{2} \sqrt{\pi } C_0 \text{erfi}(x)+C_1\right)e^{-\frac {x^2}{2}}
$$
