Integrating linearly

I came across this question and just want to make sure my understanding is correct.

I need to find the general solution of:

$$\frac{dx}{dt} = a(1 - x)$$

In this case, I'm finding the how $x$ changes with respect to $t$ so I'm integrating with respect to $t$. Does that mean the answer is $at - xat + C$?

Thanks :)

• You cannot integrate over $t$ if you have $x$ in the integral, which depends on $t$ in a yet unknown way. Separate the variables, it's the first elementary procedure you must learn to solve differential equations. Once you have $x$ on the left and $t$ on the right, you can proceed. – orion Aug 21 '18 at 9:27
• If $x(t) = t^2$, for example, then $\int x\, dt$ is clearly not $tx$. – anomaly Aug 21 '18 at 19:57

You can't say that, simply because the function $x$ has a dependence in $t$ !

If you are given, for $x=x(t)$ $$\frac{dx}{dt} = a(1-x)$$

Then, one can re-arrange (by abuse of notation), giving \begin{align} \frac{dx}{1-x} &= a\, dt \\ \implies \int \left(\frac{1}{1-x}\right)dx &= a \int dt \end{align} The right hand side is straightforward for you, the left requires some knowledge of standard integrals.

Does this help?

• Awesome! Thanks for your help, does this lead to the answer "-ln(1-x) = at + C"? – Hews Aug 21 '18 at 9:40
• Yes. You probably want to turn it around and express $x$ in terms of $t$, and possibly rename the constant $e^{-C}$ to something else, as in this form has clearer meaning in the final function compared to just $C$. – orion Aug 21 '18 at 9:45
• @orion not possibly, but necessarily. Even if we consider complex values of $C$, there is a value $e^{-C}$ can’t reach, namely 0, but the corresponding solution, the constant function $x=1$, is very much a valid solution of the original equation. – Roman Odaisky Aug 21 '18 at 15:33
• @Hews Yes that is exactly right, but as other posters point out, you possible would prefer to rearrange into $x= \ldots$ – Kevin Aug 22 '18 at 13:41
• So to express x in terms of t, does it end as x = e^(at)e(-C) - 1?. Thanks for your help everyone! – Hews Aug 22 '18 at 23:25

You must write

$$\frac{dx}{1-x}=a dt$$

If you write it as $dx = a(1-x)dt$ then it would be correct to integrate $x$ with respect to $t$. The trouble is, to perform the integration correctly, you would need to know what the dependence of $x$ on $t$ is, which is what you're trying to find out in the first place. To see what the problem with $\int xdt =xt+C$ is, consider any function, e.g. $x=t$. If we substitute $t$ in for $x$ before integrating, we get $\int tdt =\frac {t^2}2+C$. But if we use $\int xdt =xt+C$ and substitute $t$ in for $x$ afterwards, we get $\int xdt =t^2+C$, which is off by a factor of 2. Or if $x = \sin(t)$, then we would have $\int \sin(t)dt=t\sin(t)+C$ instead of $\int \sin(t)dt = \cos(t)+C$. If we had that $\int f(t)dt =tf(t)+C$, that would make the whole concept of an integral rather trivial; the integral of any function would just be that function times the independent variable. The identity $\int xdt=xt+C$ works only if $x$ doesn't depend on $t$. Remember, an integral can be interpreted as the area under a curve. If $x$ is a constant, then we just have a rectangle with width $t$ and height $x$, so the area is $xt$. But if $x$ is varying with $t$, then we can't just take the value of $x$ at the end of the interval; clearly the area is going to depend on what $x$ is doing in between.

Note that if you get familiar with basic differential forms, you should get to a point where you recognize that when the derivative is proportional to the function value, you have an exponential function. In this case, the differential equation is modified by a constant term. So if you take the test solution $x = c_1e^{c_2t}+c_3$, solve for the derivative in terms of $c_1$, $c_2$, and $c_3$, and then plug that into the differential equation, then you can solve for $c_1$, $c_2$, and $c_3$. Note that one degree of freedom will remain, since this is a first-order equation and no initial condition is given.