# Problem with solving an ordinary differential equation with integrating factor

We have the following linear ordinary differential equation and we want to solve for y:

(x-2)y' - y = 2(x-2)^3

Can you help me find where the error is? I am getting incorrect results.

First, express the equation in the standard form of an exact differential equation:

y + 2(x-2)^3 + (-x+2)y' = 0 where M = y + 2(x-2)^3 and N = -x+2

We check if the equation is exact. It isn't, so we try to find an integrating factor u(x)

We find our u(x) and multiply our equation with it:

uy + u2(x-2)^3 + u(-x+2)y' = 0

Plug in u(x) = 1/(-x+2)^2 and we get:

1/(-x+2)^2 * y + 1/(-x+2)^2 * 2(x-2)^3 + 1/(-x+2)^2 * (-x+2)y' = 0

Clean it up and we get:

1/(-x+2)^2 * y + 2x - 4 + 1/(-x+2) * y' = 0

Let's denote our potential function with F (in some materials they use the phi symbol).

dF/dx = 1/(-x+2)^2 * y + 2x - 4

In order to find F, let's integrate both sides and add g(y), which represents the information that we are unable to retrieve from a partial derivative of x. Let's absorb the constant in it.

F = (-x+2)^(-1) * y + x^2 - 4x + g(y)

Let's find out what g(y) is.

dF/dy = (-x+2)^(-1) + g'(y) = uN

Plug in uN from earlier:

dF/dy = (-x+2)^(-1) + g'(y) = (-x+2)^(-1)

And we get g'(y) = 0 so g(y) = C

Plug g(y) into F:

F = (-x+2)^(-1) * y + x^2 - 4x + C = 0

Solve for y:

y = x^3 - 6x^2 + 8x + Cx - 2C

This is incorrect. Where did I make a mistake?

P.S. I realize there are easier choices for u available, but let's not go there. I really want to find out what is wrong with this solution. Before posting this I verified that my choice for u(x) doesn't contain variables other than x and I confirmed that the equation with u(x) is exact by comparing partials derivatives. I also tried to look for blunders by verifying just about everything with Wolfram Alpha. I can't find the error.

• You bring $u(x) = 1/(-x+2)^2$ from where.? Feb 28, 2017 at 3:29
• I omitted it, because I was able to confirm that the error isn't there. I used a complicated method from a textbook. Feb 28, 2017 at 3:31
• I edited OP to fix some errors I made when I was copying things from paper. Feb 28, 2017 at 3:39
• Your answer $y = x^3 - 6x^2 + 8x + Cx - 2C$ is correct. There is no mistake happens. Feb 28, 2017 at 5:13
• $y=x^3-6x^2+8x+Cx-2C$ is the same as $y=x^3-6x^2+12x+cx-8-2c$ because $C=c+4$. Dont' use the same symbol for different constants. Feb 28, 2017 at 18:17