Since this is of form \(y^{\prime }=f\left ( y\right ) =\frac {1}{\cos y}\) and IC is given then we check if \(y=2\) satisfies the ode itself or not. \(0=\frac {1}{\cos \left ( 2\right ) }\) does not. Hence we need solve the ode. Integrating gives
Here we can solve for \(y\) or keep it implicit until finding \(c\). Let see what happens if we try to first solve for \(y\).
Applying IC gives
No solution for \(c\). Lets now go back to (1) and solve for \(c\) first from (1) before solving for \(y\). We obtain
This was much easier. Substituting this into (1) gives
Now we can solve for \(y\) using \(\sin \left ( y\right ) =A\Longrightarrow \) \(y=-\arcsin \left ( A\right ) +2\pi n+\pi \). Using this gives
For \(n\) integer. Trying \(n=0\) gives
Which satisfies the ode and the IC. It is also possible to keep the solution implicit as in (2) in this case also as (2) satisfies both the ode and IC as is and there is no need to explicitly solve for \(y\).