# Thread: Diff Eq applied to A+B->C chemical reaction

1. ## Diff Eq applied to A+B->C chemical reaction

I'm taking Applied Diff Eq and was presented with the following problem. I'm not really into applications, and chemistry isn't really my strongest subject, but the class is required and the instructor really loves them. Anyway, I just wanted to check to make sure I did this problem correctly.

Suppose A and B represent two substances that can combine to form a new substance C. Suppose we have a container with a solution containing low concentrations of substances A and B, and A and B molecules react only when they happen to come close to each other. If a(t) and b(t) represent the amount of A and B in the solution, respectively, then the chance that a molecule of A is close to a molecule of B at time t is proportional to the product $a(t)\cdot b(t)$. Hence the rate of reaction of A and B to form C is proportional to ab. Suppose C precipitates out of the solution as soon as it is formed, and the solution is always kept well mixed.

Describe an experiment you could perform to determine an approximate value for the reaction-rate parameter $\alpha$ in the system:
$\begin{array}{c}
\frac{da}{dt}=-\alpha ab\\
\frac{db}{dt}=-\alpha ab\end{array}$

Include the calculations you would perform using the data from your experiment to determine the parameter.

So here's my little experiment:

1. Start with $a(0)=M$ and $b(0)=N$
2. Let $c(t)$ represent the amount of precipitate at time $t$.
3. Let $L=c(1)$
4. $(d) \begin{array}{c}
\frac{da}{dt}\approx-L\\
\frac{db}{dt}\approx-L\end{array} , so \begin{array}{c}
a(1)\approx M-L\\
b(1)\approx N-L\end{array}$
.
5. And therefore, $\alpha\approx\frac{L}{(M-L)(N-L)}$

My final answer has to be in the form of a python program that will actually find $\alpha$, but I need to make sure that this is the correct approach.

2. Guess I'll take it anyway I can get it. I'm not proud. Assuming I can stop the reaction reliably, and accurately weight the precipitate after one unit of time which I'll denote as $c(1)=k$, I'd start with solving the following IVP in Mathematica (note I'm using positive a):

$\frac{dx}{dt}=axy;\quad x(0)=n$

$\frac{dy}{dt}=axy;\quad y(0)=m$

via the code:

Code:
DSolve[{x'[t] == a x[t] y[t], y'[t] == a x[t] y[t]},
{x, y}, t]
I obtain:

$x(t)=-\frac{c_1 Exp[a t c_1+c_1 c_2]}{Exp[a t c_1+c_1 c2]}$

$y(t)=c_1-\frac{c_1 Exp[a t c_1+c_1 c_2]}{Exp[a t c_1+c_1 c2]}=c_1-x(t)$

Like I said, I'm not proud.

Note that:

$n=-\frac{c_1 e^{c_1 c_2}}{e^{c_1 c_2}-1}$

$m=c1-\frac{c_1 e^{c_1 c_2}}{e^{c_1 c_2}-1}$

This implies $c_1=m-n$

Now:

$n=-\frac{(m-n)e^{(m-n)c_2}}{e^{(m-n)c_2}-1}$

I now solve for $c_2$:

Code:
Solve[n == -(((m - n)*Exp[(m - n)*c2])/
(Exp[(m - n)*c2] - 1)), c2]
This gives $c_2=\frac{\ln(m/n)}{m-n}$

I now substitute $c_1$ and $c_2$ into the expression for $x(t)$ to solve for a:

$n-k=-\frac{c_1 Exp[ac_1+c_1 c_2]}{Exp[a c_1+c_1 c_2]+1}$

via the code:

Code:
Solve[n - k == -((c1*Exp[a*c1 + c1*c2])/
(Exp[a*c1 + c1*c2] - 1)) /.
{c1 -> m - n, c2 -> Log[n/m]/(m - n)}, a]
This gives me:

$a=\frac{\ln\left(\frac{m(k-n)}{(k-m)n}\right)}{m-n}$

So I plot these equations with initial concentrations x=2 and y=5. If the reaction tends to completion, then we would expect to have the final concentration of y at 3 and x=0, the rate of which depending on how much of c is present after a unit of time. The first plot shows k=1, the second k=0.1. The first quickly drops to the equilibrium level. The second one with a smaller value of k takes longer. This looks reasonable.

3. Ok, so I'm on a roll with this. Sorry Wil, probably not helping you; you're long gone with this one. Anyway, I want to plot the rate constant as a function of the concentration of c after a unit of time. That is, the function:

$a(k)=\frac{\ln\left(\frac{m(k-n)}{(k-m)n}\right)}{m-n};\quad n=2, m=5$

So what would we expect? Well, the larger the amount of c after time=1, the greater the reaction rate right? This is exhibited in the plot below: the larger k is, the more quickly a becomes negative giving rise to a faster rate and the behavior exhibited in the two plots above. Makes sense to me.

4. Ok, I think I figured it out:

\begin{aligned}x'&=axy\quad \Rightarrow y=\frac{x'}{ax}\\
y'&=axy;\quad \Rightarrow x=\frac{y'}{ay}
\end{aligned}

Differentiating both equations:

\begin{aligned}x''&=a(xy'+yx')\quad\Rightarrow x''=axx'+\frac{(x')^2}{x} \\
y''&=a(xy'+yx')\quad\Rightarrow y''=\frac{(y')^2}{y}+ayy'
\end{aligned}

Using the technique for independent variable missing, letting $p=x'$ as well as $p=y'$:

\begin{aligned}p\frac{dp}{dx}&=axp+\frac{p^2}{x} \\
p\frac{dp}{dy}&=ayp+\frac{p^2}{y}
\end{aligned}

Notice at this point I can divide through by p if $p\ne 0$. Else the constant solutions $x=k_1$ and $y=k_2$ are obtained. Otherwise I get:

\begin{aligned}\frac{dp}{dx}-\frac{1}{x}p&=ax \\
\frac{dp}{dy}-\frac{1}{y}p&=ay
\end{aligned}

Solving for integrating factors for first order ODE, the integrating factor in both cases is $1/x$ and $1/y$ respectively. Here's where I'll adjust the constants to arrive at only two arbitrary constants:

$\mathop\int\limits_{\textstyle{\frac{p(0)}{x(0)}}} ^{\textstyle{\frac{p(x)}{x(t)}}} d\left(\frac{p}{x}\right)=\mathop\int\limits_{x(0) }^{x(t)} a$

which yields after using the original differential equations to adjust the constants:

$\frac{dx}{dt}=ax^2-ax(x_0-y_0)$

Likewise for y:

$\mathop\int\limits_{\textstyle{\frac{p(0)}{y(0)}}} ^{\textstyle{\frac{p(y)}{y(t)}}} d\left(\frac{p}{y}\right)=\mathop\int\limits_{y(0) }^{y(t)} a$

which yields:

$\frac{dy}{dt}=ay^2+ay(x_0-y_0)$

I now let $c_1=x_0-y_0$ and integrate the two equations:

\begin{aligned}\int_{x(0)}^{x(t)}\frac{dx}{ax^2-axc_1}&=\int_0^t dt \\
\int_{y(0)}^{y(t)}\frac{dy}{ay^2+ayc_1}&=\int_0^t dt
\end{aligned}

Yielding:

\begin{aligned}\frac{1}{a c_1}\left[\ln\left(\frac{x-c_1}{x}\right)-\ln\left(\frac{y_0}{x_0}\right)\right]&=t \\
\frac{1}{a c_1}\left[\ln\left(\frac{y}{c_1+y}\right)-\ln\left(\frac{y_0}{x_0}\right)\right]&=t
\end{aligned}

Letting $c_2=\ln(y_0/x_0)$, I obtain for the final answers:

\begin{aligned}x(t)&=-\frac{c_1}{e^{c2+a c_1 t}-1}\\
y(t)&=-\frac{c_1 e^{c2+a c_1 t}}{e^{c2+a c_1 t}-1}
\end{aligned}

where $a=\frac{1}{m-n}\ln\left(\frac{m(k-n)}{(k-m)n}\right)$

which I believe are equivalent to the answers found above. Personally Wil, I think this one would be a good one for you guys to solve analytically in class. That ain't nothing but basic differential equations up there. Anybody sees a problem with this, please let us know.

5. ## Thanks, Shawsend

Thanks for the work you put in on this problem. I'm not sure I follow everything you did, but I'll have time to reread it this evening.

Wil

6. $x'=-kxy$

$y'=-kxy$

That means $x'=y'$ So if the two derivatives are equal, then the two functions must be equal except for a constant. So: $x(t)=y(t)+c_1$

Substituting:

$y'=-ky(y+c_1)$

Integrating:

$\int \frac{dy}{y(y+c_)}=-k\int dx$

or:

$\frac{y}{y+c_1}=Exp[-c_1(kx+c_2)$

Solving for y:

$y=\frac{c_1e^{-c_1(kx+c_2)}}{1-e^{-c_1(kx+c_2)}}$

$x=c_1+y(t)$