Find a formula for $g(x)$ satisfying given conditions 
Find a formula for a function $g(x)$ satisfying the following conditions:
(a) domain of $g$ is $(-\infty,+\infty)$
(b) range of $g$ is $[-2,8]$
(c) $g$ has a period $\pi$
(d) $g(2)=3$

Well, I've have obtained a family of solutions:

$$g(x)=3+5\sin (n\pi +2x-4)$$

Where $n$ is any integer, and I am interested in knowing if there are any other solutions (except simply converting this into a $\cos$ function by using  the identity $\sin x = \cos (\frac{\pi}{2}-x)$).
If they do, please outline a sketch as to how you arrived at it. Thanks in advance!
 A: You've given perhaps one of the more elegant and most easily expressible solutions already. Most that can be written in a clean formula would probably involve the kind of function you've already constructed. But there are several less elegant ways to do this. They all come down to manipulating familiar graphs on an interval of length $\pi$, and "copy-pasting" them across $\mathbb R$. 
One strategy that comes to mind is to use what's called a "sawtooth function", which is essentially repeated copies of the absolute value function. One way you can construct this is thinking of a transformation of the absolute value function that is centered at some number $c$, with $c-\frac \pi 2 < 2 < c+\frac \pi 2$, and whose graph contains the points $(c,8)$, $(2,3)$, $(c-\frac \pi 2, -2)$, and $(c+\frac \pi 2, 2)$. After some thought, one way of solving this leads to $c = 2+\frac \pi 4$, and the function becomes 
$$
g(x) = 8-\frac{20}\pi\left|x-\frac \pi 4 - 2\right|
$$
Obviously this isn't periodic, but you can construct a periodic function by cutting this function off at $x=2-\frac \pi 4$ and $x=2+\frac{3\pi}4$ and repeating it on these intervals. Explicitly, this could be expressed as: 
$$
g(x) = 8-\frac{20}\pi\left|x-n\left(\frac \pi 4 - 2\right)\right|, \quad \textrm{for} \quad n\left(2+\frac \pi 4\right)-\frac \pi 2 \leq x \leq n\left(2+\frac \pi 4\right)+\frac \pi 2
$$
but it's more typically considered as a kind of "sawtooth graph". Constructions like this abound; I came up with one that looks like an EKG monitor, for example :) you can get pretty creative! 
