Recall that the general formula of a cosine function is of the form
where A is the amplitude, D is the midline, the number C/B is the phase shift and the number 2*pi/B is the period.
We are told that A=3 and D=5. Also, we are told that the period is pi/2. Since we don't have any information regarding the phase shift, we will asume that the phase shift is 0. Then we have the following equations:
and
From the first equation we deduce that C should be zero. From the second equation by multiplying by B on both sides and dividing by pi on both sides, we get
If we multiply by 2 on both sides, we get
so gathering our previous results, we get the formula