# Getting Mathematica to solve a system of two second order nonlinear ordinary differential equations

I tried solving a system of two second order nonlinear ordinary differential equations using the DSolve command. First, I tried like this:

eqns = {A''[x] == 2/B[x]*A'[x]*B'[x],
B''[x] + 1/B[x]*(A'[x])^2 - 1/B[x]*(B'[x])^2 == 0};
sol = DSolve[eqns, {A, B}, x]


However, as Mathematica didn't (couldn't?) solve this, I transformed it into a system of four first order equations:

eqns = {c'[x] == 2/B[x]*c[x]*d[x],
d'[x] + 1/B[x]*(c[x])^2 - 1/B[x]*(d[x])^2 == 0, c[x] == A'[x],
d[x] == B'[x], c[0] == 1, d[0] == 1, A[0] == 1, B[0] == 1};
sol = DSolve[eqns, {A, B, c, d}, x]


This still doesn't work. Weirdly enough, I don't even get an error message.

I only included the boundary conditions thinking that they may be helpful, but they aren't part of my original problem.

Your help would be greatly appreciated:)

• This is a non linear ODE, are you sure that a closed form solution exists? If I choose initial conditions and use "NDSolve" I can easily get numerical solutions. E.g. (A[0] == 1, B[0] == 1, A'[0] == .1, B'[0] == .1) Apr 21 at 16:28
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Apr 22 at 18:20

## 1 Answer

With a bit of assistance, DSolve can produce a symbolic answer, as desired. Solve the first ODE for A'[x],

Equal@@(D[DSolve[eqns // First, A[x], x], x][[1, 1]])
(* A'[x] == B[x]^2 C[1] *)


and use this result instead of the first ODE

FullSimplify@DSolve[{%, eqns // Last}, {A[x], B[x]}, x] /. C[1] -> C[1] Sqrt[C[2]]
/. Sqrt[Sech[z_]^2] -> Sech[z]
(* {{B[x] -> -Sech[(x - C[2]) Sqrt[C[2]]]/C[1],
A[x] -> C[4] + Tanh[(x - C[2]) Sqrt[C[2]]]/C[1]},
{B[x] ->  [Sech[(x - C[2]) Sqrt[C[2]]]/C[1],
A[x] -> C[4] + Tanh[(x - C[2]) Sqrt[C[2]]]/C[1]},
{B[x] -> -Sech[Sqrt[C[2]] (x + C[2])]/C[1],
A[x] -> C[4] + Tanh[Sqrt[C[2]] (x + C[2])]/C[1]},
{B[x] ->  Sech[Sqrt[C[2]] (x + C[2])]/C[1],
A[x] -> C[4] + Tanh[Sqrt[C[2]] (x + C[2])]/C[1]}} *)


These solutions can be verified by

% /. Rule[z1_, z2_] :> Rule[Head[z1], Function[x, z2]];
FullSimplify[eqns /. %]
(* {{True, True}, {True, True}, {True, True}, {True, True}} *)