During the discussion of integrated rate laws (and more generally in science), you’ll often see people trying to bring some equation to a linear form.

For example, take the first-order reactions. There are two ways to represent the dependence of the concentration on the time:

$ln[A]_{t}=ln[A]_{0}−ktand[A]_{t}=[A]_{0}e_{−kt}$The second form may even seem to be more useful as we can conclude something about the shape of $[A]$ vs $t$ dependence (it being an exponential decay). So why do we care about straight lines?

## Estimating Order from Experimental Data.

The problem at hand is that it’s not easy to differentiate first-order kinetics from second-order one. Let’s plot the integrated equations for 1st and 2nd order using our friend Desmos:

the red curve is 0 order, purple is 1st order, and black is 2nd order. My math intuition tells me that the black line has a very similar shape to the purple line and if we vary the parameters ($[A]_{0}$ and $k$), we might make them coincide. It took me a couple of seconds to achieve this: where the purple line is 2nd order with different parameters. It’s definitely different from the 1st order curve for large $x$, but it looks very close for $x<0.8$.

Now, let’s imagine you measure the concentration $[A]$ at regular intervals of time and you get a bunch of data points:

What is the reaction order with respect to $[A]$? Well, the data doesn’t look linear, so it’s definitely not a zero-order reaction. But is it 1st or 2nd order? It’s hard to tell!

Now, let’s look at the plots of the $1/[A]_{t}$ and $ln[A]_{t}$: (disregard the y-axis title for these plots, it should be “inverse concentration” and “log concentration” respectively)

The second one looks way more like a straight line, so we might conclude that this is likely to be a first-order reaction. The key takeaway, is that we **couldn’t have made this conclusion by looking at concentration directly**.

## Lines are easier to Fit

Okay, we established that the data above results from a process obeying first-order kinetics. Could we somehow estimate the rate constant $k$ and initial concentration $[A]_{0}$? In other words, can we fit that data to the equation:

$[A]_{t}=[A]_{0}e_{−kt}$If you were to live in 20th century the answer would be pretty much practically no. Even now, if you don’t know how to code (even with Python), the answer would be also pretty much no. Especially if we were to deal with something like a second-order kinetics, that’d be impossible to model directly with Excel.

However, it’s remarkably easy to find line of best fit for linear data. You can do this analytically using Least Squares Method.

### Unless you can do Python

I firmly believe that anyone can learn Python to the level of being able to simplify your life and perform data analysis. With the same confidence, I believe that knowing python will give you a light-year boost on a job market, regardless of your vocation. Let me know if you want some advice on how to start learning python!

With python, we can do: ($y$ is a collection of datapoints, $t$ is times at which they were taken)

and the `popt_first`

will contain optimal values of $a_{0}$ and $k$. You could ask, oh my, could I also try & fit 0 and 2nd order? Yeah:

Nice. But can I quantify the quality of the fit, I don’t know, find R^2? Yeah:

Can we plot this? Sure:

Do you want me to tell you a dirty secret? I have Github Copilot (free for students), with which I simply wrote a comment

and it generated the code above for me.

In fact, if we try to do this on data above, we get the following fits:

If you’re curious, I generated the data with this code:

The first line essentially makes equally spaced times between 0.1 and 3 with a step of 0.1, and then between 3 and 5 with a step of 0.2 units. The second line defines parameters, and the third line creates an exponential decay with some noise (the noise is added by multiplying by some normal distribution around a factor of 1).

Which means that the optimal fit was pretty close to the true values of $a_{0}$ and $k$!