Let g(x)=f(x)cosx. Since
g(−π/2)=g(0)=g(π/2)=0, by Rolle's theorem there exist
some ξ1∈(−π/2,0) and ξ2∈(0,π/2) such that
g′(ξ1)=g′(ξ2)=0.
Now consider the function
h(x)=cos2xg′(x)=cos2xf′(x)cosx−f(x)sinx.
We have h(ξ1)=h(ξ2)=0, so by Rolle's theorem there exist
ξ∈(ξ1,ξ2) for which
0=h′(ξ)=cos4ξg′′(ξ)cos2ξ+2cosξsinξg′(ξ)==cos3ξ(f′′(ξ)cosξ−2f′(ξ)sinξ−f(ξ)cosξ)cosξ+2sinξ(f′(ξ)cosξ−f(ξ)sinξ)==cos3ξf′′(ξ)cos2ξ−f(ξ)(cos2ξ+2sin2ξ)=cosξ1(f′′(ξ)−f(ξ)(1+2tan2ξ)).
The last yields the desired equality.