Since its domain is unbounded and range is bounded assume it to be sinusoidal function.
Function of the form Asin(x+k) + b has period 2pi.
But here the period is pi , so replace x by 2x.
g(x) = Asin(2x+k) + B
max{g(x)} = A + B = 8
min{g(x)} = -A + B = -2
these two give : A=5 and B=3
g(x) = 5sin(2x+k) + 3
now last condition :
g(2) = 3
5sin(4+k) + 3 = 3
sin(4+k) = 0
k = -4
Hence g(x) = 5sin(2x-4) + 3
Many other functions are also possible of the form Asin(2x+k)+Bcos(2x+k)+C.