A cosine function has the form.

Where A refers to the changes of the y-coordinate along the curve, that is, the amplitude. And B refers to the period, that is, the repetition period of the curve.
According to the graph, the amplitude is 1, so A = 1.
Notice that from 0 to 2(pi) the function completes two cycles, which means B = 3.
Therefore, the function is
