With no horizontal shift, a general cosine function is
where a is the amplitude, b determines the period, and d is the vertical shift.
In this problem the amplitude is 3 and the vertical shift is +1, so the equation is
To find the value of the parameter b, note that the basic cosine function has a period of 2pi while the given function has a period of pi/2. That means the function completes 4 cycles from 0 to 2pi; that means b is 4.
(Algebraically, b is equal to 2pi divided by the period; in this example, (2pi)/(pi/2) = 4.)