# Solving the simplest coupled nonlinear ODES for chemical kinetics [closed]

I am just trying to get the integrated form for the kinetics of the reaction $A + B \rightarrow C + D$ characterized by:

$$-\dfrac{d[A]}{dt} = -\dfrac{d[B]}{dt} = k[A][B] \; .$$

As you note, this is a system of two nonlinear coupled ordinary differential equations, I will put that in the familiar notation for mathematicians or physicists:

$$\dfrac{dx(t)}{dt} = -k x(t) y(t)$$ $$\dfrac{dy(t)}{dt} = -k x(t) y(t)$$ Can anyone helping me with some reference or ideas to solve it?

-

## closed as off-topic by David Z♦May 29 at 15:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Homework-like questions should ask about a specific physics concept and show some effort to work through the problem. We want our questions to be useful to the broader community, and to future users. See our meta site for more guidance on how to edit your question to make it better" – David Z
If this question can be reworded to fit the rules in the help center, please edit the question.

@David Z. I didn't have clue about how to start and the answers were very helpful. Perhaps the best was the given by Qmechanic, since it was enough to solve the problem to realize that y - x = constant. But I liked all the answers, these are a piece of great work –  dapias May 30 at 3:31

Since the rate of change of $x$ is the same as the rate of change of $y$ you really only a single equation of with one variable. We write, $$x = y + c$$ where the constant $c$ is determined by your initial conditions, $$c = x (0) - y (0)$$ (in your case it is the difference between the concentrations at the start). Inserting in this relation we have, $$x' = -k ( x ^2 - x c )$$ This is now a simple equation to solve, $$\int _{x _0 } ^{ x} \frac{ d x }{ - k ( x ^2 - x c ) } = \int _0 ^t d t$$ where $x _0 \equiv x ( 0 )$. Resorting to Mathematica (though you could use partial fractions) gives, $$\log \left[ \frac{ x }{ x _0 } \frac{ x _0 - c }{ x - c } \right] = kt$$ Isolating for $x$ I get, $$x = - \frac{ c e ^{ kt} }{ \alpha - e ^{ kt} }$$ where $\alpha \equiv ( x _0 - c ) / x _0$.

Plotting $x$[red] and $y$[blue] for different $x0$ and setting $c=1$ we have,

$\hspace{2cm}$

-
I'm not deleting this in this case because it's already been accepted, but for future reference, please don't post complete answers to homework-like questions. –  David Z May 29 at 15:04
@DavidZ: I initially had the impression that the OP was a chemist and needed it for their research, but you certainly could be correct. –  JeffDror May 29 at 15:30
Yeah, that could be the case, but I still think it qualifies as homework-like because the question is asking us to solve something for the OP. Any question of that nature, where the OP just posts their issue and says "solve this for me" (or anything to that effect) falls under our homework policy, I think, regardless of whether it's actual homework. And if it was needed for research, a high-level explanation without a full solution would still be a sufficient answer. Though this is a close one. –  David Z May 29 at 15:35

Hints:

1. Conclude that $y-x=c$ is a constant.

2. Use separation of variables $-k\int \!\mathrm{d}t= \int \!\frac{\mathrm{d}x}{x(x+c)}$.

-

The other answers address how to solve this analytically, but I like numerical solutions to things so here goes:

$$\frac{d}{dt} \begin{bmatrix}x \\ y \end{bmatrix} = -\begin{bmatrix}kxy\\kxy\end{bmatrix}$$

which can be solved using any number of numerical methods. For simplicity, we can take the second-order Runge-Kutta method where $i$ is the time index.

Step 1:

\begin{aligned}x^{i+1/2} &= x^i - \Delta t k x^i y^i\\y^{i+1/2} &= y^i - \Delta t k x^i y^i\end{aligned}

Step 2:

\begin{aligned}x^{i+1} &= \frac{1}{2}\left(x^i + x^{i+1/2} - \Delta t k x^{i+1/2} y^{i+1/2}\right)\\y^{i+1} &= \frac{1}{2}\left(y^i + y^{i+1/2}- \Delta t k x^{i+1/2} y^{i+1/2}\right)\end{aligned}

This method is then marched until you reach your physical time of interest or until you reach steady state (which is $t \rightarrow \infty$ technically but may be truncated by measuring the residuals and stopping when they approach zero.

Some care must be taken when choosing your time step, $\Delta t$. Too large and the integration will be unstable. Too small and you're wasting time.

Analytical methods are awesome and all but the numerical approach will work for much more complicated mechanisms and with way more coupled equations. So it's a good tool to have in the box.

-
Although I now realized that OP doesn't want "how to solve it" but actually wants the integrated equation... which isn't what I answered here. But I'd rather not delete it, maybe somebody else would find it useful. –  tpg2114 May 27 at 23:35
Definitely keep it. It's a nice answer and someone will certainly make use of it in the future. –  JeffDror May 27 at 23:43
@JeffDror Thanks -- I was more hedging against possible downvotes for not answering the question... Pre-emptive mea culpa! –  tpg2114 May 28 at 0:05