According to the given condition
slope of tangent, m=dy/dx
dydx=yx−cos2yx....(i)
This is a homogeneous differential equation. Substituting y=vx, we get
v+xdvdx=v−cos2v⇒xdvdx=−cos2v
⇒sec2vdv=−dxx⇒tanv=−logx+c∫sec2vdv=∫−dxx
⇒tanyx+logx=c...(ii)
Substituting x=1, y=π4, we get c=1.
Thus, we get
tan(yx)+logx=1, which is the required equation.