This is tricky problem from textbook. Mathematica DSolve can't solve it. Maple gives same solution as given in back of textbook. First will show the problem

ClearAll[y, x]
ode = x^2*y'[x]*Cos[y[x]] + 1 == 0
ic = y[Infinity] == 16/3*Pi 
sol = DSolve[{ode, ic}, y[x], x]


DSolve::bvnul: For some branches of the general solution, the given 
 boundary conditions lead to an empty solution.    

This is what the solution should be (same as back of book) by Maple



 sol := y(x) = arcsin((sqrt(3)*x - 2)/(2*x)) + 5*Pi

The issue is this. With no IC, Mathematica gives correct solution

 sol = DSolve[ode, y[x], x]

 (* {{y[x] -> ArcSin[(1 + x  C[1])/x]}} *)

But because arcsin is defined for -Pi/2<x<Pi/2 and ic says at x=Infinity y is 16/3*Pi which is outside the range, it can't solve for the C[1] because of this

Using an IC where the angle is in the correct region, it can now solve it

ic = y[Infinity] == Pi /3
sol = DSolve[{ode, ic}, y[x], x]

(* {{y[x]->ArcSin[(1+(Sqrt[3] x)/2)/x]}} *)

This explains the extra 5*Pi that Maple had there in the answer which is also what the book shows.

But I do not know how to trick DSolve to do this.

Any suggestions how to obtain this solution using Mathematica?

V 14 on windows 10

ps. can't paste images any more due to this bug in stackexchange. This is very annoying. SEuploader also does not work. So now we have to live with no images in posts.

  • $\begingroup$ Even DSolve[ode, y[x], x] does not produce a general solution, warning "Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.". The same issue with the command of Maple 2024 dsolve(x^2*diff(y(x), x)*cos(y(x)) + 1 = 0). $\endgroup$
    – user64494
    Apr 18 at 9:09

2 Answers 2


Try to solve the equivalent inverse problem

X = Values@DSolve[x[y]^2/x'[y] *Cos[y ] + 1 == 0, x, y][[1, 1]] /.C[1] -> c1
(*Function[{y}, 1/(-c1 + Sin[y])]*)

Boundary condition Infinity==X[16Pi/3]

X[16Pi/3] (*1/(-(Sqrt[3]/2) - c1)*)

is fullfilled if c1==-Sqrt[3]/2

X[y]/. c1->-Sqrt[3]/2 (*1/(Sqrt[3]/2 + Sin[y])*) 

Solution matchs Maple-solution:

Show[ParametricPlot[{x, ArcSin[(Sqrt[3]*x - 2)/(2*x)] + 5*Pi}, {x, 0,20 }, AspectRatio -> 1], 
ParametricPlot[{1/(Sqrt[3]/2 + Sin[y]), y}, {y, 15, 17},PlotStyle -> {Dashed, Red}]]

enter image description here

  • $\begingroup$ It remains to execute Reduce[1/(Sqrt[3]/2 + Sin[y]) == x, y, Reals] // FullSimplify. $\endgroup$
    – user64494
    Apr 18 at 11:24

This is an extended comment correcting my previously erroneous answer which just sought to match the solution to initial condition. This checks tentative solutions by substituting into DE.

y[x_, n_] :=n Pi+ ArcSin[1/x+Sqrt[3]/2]
tab = Table[{y[x,j],x^2 D[y[x, j],x]Cos[y[x,j]]+1,Limit[y[x,j],x->Infinity]}, {j,0,5}]

Grid[{{"Tentative solution", " LHS DE","y[Infinity]"}} ~Join~ tab]

enter image description here


Confirming the correct solution as per @user64494 (and just sign change):

enter image description here

Comment: I do not have access to computer at present. This cloud based and from phone. The result in first instance was a comment re: OP provided answer for modified ic to get MMA answer. The addendum shows, the alternating sign issue.

Final comment

The issue is sign changes in domain. As contrived approach to get answer:

y[x_]:= g[x] + 5 Pi;
y[x]/. DSolve[{x^2y'[x]Cos[y[x]]+1==0, y [Infinity] == 16 Pi / 3}, g[x],x][[1]]

enter image description here

  • 1
    $\begingroup$ Shouldn't periodicty be y[x+2Pi k]==y[x]? $\endgroup$ Apr 18 at 11:14
  • $\begingroup$ My first answer was stupid and shameful. So, thanks. It highlighted a sign change issue in arcsin… $\endgroup$
    – ubpdqn
    Apr 18 at 14:00
  • $\begingroup$ The true solution is $$ \arcsin\left(\left(\mathrm{sqrt}\left(3\right)x-2\right)/\left(2x\right)\right)+5\pi,$$not $$ \arcsin\left(\left(\mathrm{sqrt}\left(3\right)x+2\right)/\left(2x\right)\right)+5\pi.$$ $\endgroup$
    – user64494
    Apr 18 at 14:40
  • $\begingroup$ Thank you that is helpful and consistent with comment. The solution in comment is what was written in OP. I will comment no further. $\endgroup$
    – ubpdqn
    Apr 18 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.