Let the three numbers in G.P be $\frac ar,a,ar$
\begin{align} &\frac ar+a+ar=31 \\ and\ &\frac {a^2}{r^2}+a^2+a^2r^2=651\\\ &\implies a(r+\frac1r+1)=31\\ and\ & a^2(r^2+\frac{1}{r^2}+1)=651 \end{align} How to solve further please help...
Let the three numbers in G.P be $\frac ar,a,ar$
\begin{align} &\frac ar+a+ar=31 \\ and\ &\frac {a^2}{r^2}+a^2+a^2r^2=651\\\ &\implies a(r+\frac1r+1)=31\\ and\ & a^2(r^2+\frac{1}{r^2}+1)=651 \end{align} How to solve further please help...
Let's suppose that your numbers are $ a, ar$ and $ ar^2$. Then we have by hyphotesis $$ a+ar+ar^2=31, $$ $$ a^2+a^2r^2+a^2r^4=651. $$
Then $ a(1+r+r^2)=31$ and $ a^2(1+r^2+r^4)=651$. So $$ a^2(1+r^2+r^4)=a^2(1+r+r^2)(r^2-r+1)=(a(1+r+r^2))(a(r^2-r+1))=$$ $$=31a(r^2-r+1)=651.$$
Thus we deduce that $ a(r^2-r+1)=21$. This toguether with $ a(r^2+r+1)=31$ lead us to $2ar=10$, i.e, $ ar=5$ and $2(ar^2+a)=52$, i.e., $ a+ar^2=a+5r=26$. Thus if we replace $ r=5/a $ we obtain the quadratic equation in $ a $: $ a^2-26a+25=0$. An easy factorization shows us that this equation has $ a=1$ and $ a=25$ as solutions.
If $ a=1$, then $ r=5$ and hence the numbers are $1, 5$ and $25$.
If $ a=25$, then $ r=1/5$ and hence the numbers are $25, 5, 1$. In any case we have the same numbers, namely: $1, 5$ and $25$.
Remark: In the solution of the problem I used the identity $$x^4+x^2+1=(x^2+x+1)(x^2-x+1).$$
This identity is known, at least in the latin american mathematical community, as Argand's identity.
Hint
You didn't specify if $a,r$ must be natural integers. I will suppose so.
The relation $a(r+\frac{1}{r}+1)=31$ can be writen :
$$a(r^2+r+1)=31r$$
So $(r^2+r+1)\mid31r$. Since $gcd(r^2+r+1,r)=1$, Gauss theorem shows that $r^2+r+1\mid31$.
Now $31$ is a prime number; so $r^2+r+1$ must be equal to $1$ or $31$. Clearly, the former can't hold. So $r^2+r+1=31$. This last equation has got only one positive solution : $5$
You should now use the hypothesis $a^2(r^2+\frac{1}{r^2}+1)=651$ ...
Given
$a+ar+ar^2=31\\ a^2+a^2r^2+a^2r^4=651$
square the first equation
$a^2+a^2r^2+a^2r^4+2(a^2r+a^2r^3+a^2r^2)=961\\
a^2+a^2r^2+a^2r^4+2r(a^2+a^2r^2+a^2r)=961\\
651+2r(a^2+a^2r^2+a^2r)=961\\
2r(a^2+a^2r^2+a^2r)=310\\
2ar(a+ar^2+ar)=310\\
2ar(31)=310\\
ar=5\\
a=\dfrac{5}{r}$
From first equation
$a+ar+ar^2=31\\
a(1+r+r^2)=31\\
\dfrac{5}{r}(1+r+r^2)=31\\
\dfrac{1}{r}(1+r+r^2)=\dfrac{31}{5}\\
\dfrac{1}{r}+1+r=\dfrac{31}{5}\\
1+r+r^2=\dfrac{31r}{5}\\
5+5r+5r^2=31r\\
5r^2-26r+5=0$
Solving this quadratic equation gives $r=5$
$a=\dfrac{5}{r}=1$
So numbers are
$1,5,25$