Set t=tanx, so dxdt=sec2x. Dividing the equation by sec2x transforms it to dtdy+2y=2+3t.
A linear particular solution is y=(23)t+41. The general solution is therefore y=(23)t+41+Ce−2t. At x=0,t=0 and y=45, which gives C=1.
At x=4π we have t=1, so y(4π)=47+e−2. Thus 12[y(4π)−e−2]=12(47)=21.