# DiffEq Initial Value problem

## Homework Statement

Solve the initial value problem:

dx/dt = x(2-x) x(0) = 1

## Homework Equations

Problem statement.

## The Attempt at a Solution

Based on the format, I attempted to solve the problem as a separable differential equation:

∫dx/(x[2-x]) = ∫dt

Evaluating to:

(ln|x|)/2 - (ln|2 - x|)/2 + C = t + C

Simplifying

ln|x| - ln|2 - x| + 2C = 2t + 2C

Cancelling the constant

ln|x| - ln|2 - x| = 2t

Removing the logs

x - (2 - x) = e^2t

Simplifying further

2x - 2 = e^2t

And finally solving for x:

(e^2t)/2 + 1

Which gives me a function, but for t = 0, x(0) = 3/2, not 1.

Should I be using another technique, or did I make a mistake somewhere in the process above?

Related Calculus and Beyond Homework Help News on Phys.org
CAF123
Gold Member
The reason you are given initial conditions so that you can evaluate the constant, so it shouldn't disappear. I didn't check the integration but instead write :$$\ln|x| - \ln|2-x| + K = 2t + 2C\,\,\,\text{and so} \ln|x| -\ln|2-x| = 2t + D$$ where D = 2C - K. Now evaluate D using initial conditions.

The reason you are given initial conditions so that you can evaluate the constant, so it shouldn't disappear. I didn't check the integration but instead write :$$\ln|x| - \ln|2-x| + K = 2t + 2C\,\,\,\text{and so} \ln|x| -\ln|2-x| = 2t + D$$ where D = 2C - K. Now evaluate D using initial conditions.
Attempting to evaluate using

$$ln|x| -\ln|2-x| = 2t + D$$

Returns

$$x = e^{2t+D} + 1$$

Hmmm.... Perhaps resubstituting so that....

$$x = e^{2t}e^{D} + 1$$

And assuming e^D = some constant A

$$x = Ae^{2t} + 1$$

Which looks similar to the equation for radioactive decay.

But that only seems to satisfy the initial condition for A = 0, and while that does seem like a potential solution, it also implies that $$x(t) = Ae^{2t} + 1 = 1 \forall t$$ (sorry for bad formatting with the last bit, this is the first time I've ever actually used latex), which seems like it will be a problem.

HallsofIvy
Homework Helper
Attempting to evaluate using

$$ln|x| -\ln|2-x| = 2t + D$$
Yes, that's correct.

Returns

$$x = e^{2t+D} + 1$$
How in the world did you get this?

Hmmm.... Perhaps resubstituting so that....

$$x = e^{2t}e^{D} + 1$$

And assuming e^D = some constant A

$$x = Ae^{2t} + 1$$

Which looks similar to the equation for radioactive decay.

But that only seems to satisfy the initial condition for A = 0, and while that does seem like a potential solution, it also implies that $$x(t) = Ae^{2t} + 1 = 1 \forall t$$ (sorry for bad formatting with the last bit, this is the first time I've ever actually used latex), which seems like it will be a problem.

vela
Staff Emeritus
Homework Helper

## Homework Statement

Solve the initial value problem:

dx/dt = x(2-x) x(0) = 1

## Homework Equations

Problem statement.

## The Attempt at a Solution

Based on the format, I attempted to solve the problem as a separable differential equation:

∫dx/(x[2-x]) = ∫dt

Evaluating to:

(ln|x|)/2 - (ln|2 - x|)/2 + C = t + C

Simplifying

ln|x| - ln|2 - x| + 2C = 2t + 2C

Cancelling the constant

ln|x| - ln|2 - x| = 2t
The two constants of integration aren't necessarily equal, so you can't cancel them like you did. You usually combine them anyway, so typically, you just include the constant on one side of the equation after integrating.
$$\int \frac{dx}{x(2-x)} = \int dt \hspace{2em} \Rightarrow \hspace{2em} \frac{1}{2}\ln \lvert x \rvert - \frac{1}{2}\ln \lvert 2-x \rvert = t+C$$
Removing the logs

x - (2 - x) = e^2t
This is wrong. ##e^{\ln a + \ln b} \ne a+b##. You need to review how to work with logarithms.

Simplifying further

2x - 2 = e^2t

And finally solving for x:

(e^2t)/2 + 1

Which gives me a function, but for t = 0, x(0) = 3/2, not 1.

Should I be using another technique, or did I make a mistake somewhere in the process above?

The two constants of integration aren't necessarily equal, so you can't cancel them like you did. You usually combine them anyway, so typically, you just include the constant on one side of the equation after integrating.
$$\int \frac{dx}{x(2-x)} = \int dt \hspace{2em} \Rightarrow \hspace{2em} \frac{1}{2}\ln \lvert x \rvert - \frac{1}{2}\ln \lvert 2-x \rvert = t+C$$

This is wrong. ##e^{\ln a + \ln b} \ne a+b##. You need to review how to work with logarithms.
##e^{\ln a + \ln b} = ab## and ##e^{\ln a - \ln b} = \frac{a}{b}##correct?

In which case,

$$\frac{x}{2-x} = e^{2t}e^{D}$$

Is this on the right track?

vela
Staff Emeritus
Homework Helper
Yup. So now apply the initial condition and solve for D. Note that ##e^D## is a constant, so you can write the righthand side as ##Ke^{2t}## and solve for K instead.

Last edited:
Yup. So now apply the initial condition and solve for D. Note that ##e^D## is a constant, so you can write the righthand side as ##Ke^{2t}## and solve for K instead.
Ok. So $$\frac{x}{2-x} = e^{2t}e^{D}$$, and calling $$e^D = K$$

## \frac{x}{2-x} = Ke^{2t}##, applying initial condition x(0) = 1, t = 0

## Ke^{0} = 1 ##

Given e^0 = 1, K = 1?

Mark44
Mentor
You have a solution, so you don't need us to verify it for you. If your equation satisfies the initial condition and the differential equation, you're done.