If 8,x,y and 12 are in GP find the value of x and y. Also if 8, x, y and 12 are in AP find the value of x and y

8 r = x

8 r^2 = y
8 r*3 = 12
r^3 = 12/8 = 3/2
r = 1.5^(1/3)
x = 8 * 1.5^(1/3)
y = 8 *1.5^(2/3)

8 + d = x
8 + 2 d = y
8 + 3 d = 12
so
16 + 3 d = x+y
8 + 3 d = 12
-----------------
8 = x+y - 12
x + y = 20
so 20 = 16 + 3d
d = 4/3
x = 8+4/3
y = 8+ 8/3