[tex]a_2=6;\ S_n=24\\\\S_n=\dfrac{a_1}{1-r};\ a_1=\dfrac{a_2}{r}\\\\therefore\ S_n=\dfrac{\frac{a_2}{r}}{1-r}=\dfrac{a_2}{r(1-r)}=\dfrac{a_2}{r-r^2}\\\\subtitute:\\\\\dfrac{6}{r-r^2}=24\\\\\dfrac{6}{r-r^2}=\dfrac{24}{1}\ \ \ \ \ |cross\ multiply\\\\24(r-r^2)=1\cdot6\\\\24r-24r^2=6\ \ \ \ |divide\ both\ sides\ by\ 6\\\\4r-4r^2=1\ \ \ \ \ |subtract\ 1\ from\ both\ sides\\\\4r-4r^2-1=0\\\\-4r^2+4r-1=0\ \ \ \ \ |change\ signs\\\\4r^2-4r+1=0\\\\(2r)^2-2\cdot2r\cdot1+1^2=0\ \ \ \ |use\ a^2-2ab+b^2=(a-b)^2[/tex]
[tex](2r-1)^2=0\iff2r-1=0\ \ \ \ \ |add\ 1\ to\ both\ sides\\\\2r=1\ \ \ \ \ \ |divide\ both\ sides\ by\ 2\\\\\boxed{r=\frac{1}{2}}[/tex]