Let the G.P. is ,
`a,ar,ar^2,...oo`
Here, `a` is the first term and `r` is the common ratio of the G.P.
Then,
`S = a/(1-r) => a = S(1-r)`
Now, second G.P. will be,
`a^2,a^2r^2,a^2r^4...oo`
Then,`S_1 = a^2/(1-r^2)`
`=>S_1 = (S(1-r))^2/((1-r)(1+r))`
`=>S_1 = (S^2(1-r))/(1+r)`
`=>S_1/S^2 = (1-r)/(1+r)`
`=>S_1+rS_1 = S^2 -rS^2`
`=>r = (S^2-S_1)/(S^2+S_1)`
Now, `a = S(1-r) = S(1-(S^2-S_1)/(S^2+S_1))`
`=(S(S^2+S_1-S^2+S_1))/(S^2+S_1)`
`=> a= (2SS_1)/(S^2+S_1).`