# Variation of Parameters

Variation of parameters, like method of undetermined coefficients, is another method for finding a particular solution of the nth-order linear differential equation L(y)=phi(x) once the solution of the associated homogeneous equation L(y) = 0 is known.

Recall from linear independence note, that if y_1(x),\ y_2(x),\ ...,\ y_n(x) are n linearly independent solutions of L(y)=0, then the general solution of L(y)=0 is y_h=c_1 y_1(x)+c_2 y_2(x)+...+c_n y_n(x) .

A variation of parameter method assumes that particular solution has form of homogeneous solution except that constants c_i (i=1, 2, ..., n) are functions of x (that's why it is called variation of parameter): y_p=c_1(x) y_1(x)+c_2(x)y_2(x)+...+c_n(x)y_n(x) .

We know y_i(x) (i=1, 2, ..., n) but we need to determine c_i(x) (i=1, 2, ..., n).

For this set up following linear system of equations:

{(c_1'y_1+c_2'y_2+...+c_n'y_n=0),(c_1'y_1'+c_2'y_2'+...+c_n'y_n'=0),(...),(c_1'y_1^((n-1))+c_2'y_2^((n-1))+...+c_n'y_n^((n-1))=0),(c_1'y_1^((n))+c_2'y_2^((n))+...+c_n'y_n^((n))=0):}

Then integrate each c_i' to obtain c_i , disregarding all constants of integration. This is permissible because we are seeking only one particular solution.

Since y_1(x),\ y_2(x),\ ...,\ y_n(x) are n linearly independent solutions of the same equation L(y) = 0, their Wronskian is not zero. This means that the system has a nonzero determinant and can be solved uniquely for c_1'(x),\ c_2'(x),\ ...,\ c_n'(x) .

The method of variation of parameters can be applied to all linear differential equations. It is therefore more powerful than the method of undetermined coefficients, which is restricted to linear differential equations with constant coefficients and particular forms of phi(x) . Nonetheless, in those cases where both methods are applicable, the method of undetermined coefficients is usually the more efficient and, hence, preferable.
As a practical matter, the integration of v_i'(x) may be impossible to perform. In such an event, other methods (in particular, numerical techniques) must be employed.

Example 1. Solve y''-2y'+y=(e^x)/x .

Homogeneous solution is y_h=c_1e^(x)+c_2xe^x .

To find particular solution, set up system:

{(c_1'e^x+c_2'xe^x=0),(c_1'(e^x)'+c_2'(xe^x)'=(e^x)/x):}

or

{(c_1'e^x+c_2'xe^x=0),(c_1'e^x+c_2'(xe^x+e^x)=(e^x)/x):}

Subtract first equation from second: c_2'e^x=(e^x)/x or c_2'=1/x .

From first equation c_1'=-c_2'x=-1/x x=-1 .

So, c_2=int 1/x dx=ln(|x|) and c_1=int -1dx=-x .

So, y_p=c_1e^x+c^2xe^x=-xe^x+ln(|x|)xe^x .

Finally, general solution is y=y_h+y_p=c_1e^x+c_2xe^x-xe^x+ln(|x|)xe^x=c_1e^x+c_3xe^x+ln(|x|)xe^x where c_3=c_2-1 .

Example 2. Solve 2y''-3y'+y=e^x .

Corresponding homogeneous equation is 2y''-3y'+y=0 . Characteristic equation is 2r^2-3r+1=0 which has roots r_1=1, r_2=1/2 .

So, y_h=c_1e^x+c_2e^(1/2 x) .

Now, be careful with applying variation of parameters. To apply it correctly coefficient near the highest derivative must be 1, so first divide both sides of differential equation by 2: y''-1.5y'+0.5y=1/2 e^x .

Now, set up system:

{(c_1'e^x+c_2'e^(1/2 x)=0),(c_1'(e^x)'+c_2'(e^(1/2 x))'=1/2 e^x):}

Or

{(c_1'e^x+c_2'e^(1/2 x)=0),(c_1'e^x+1/2 c_2'e^(1/2 x)=1/2 e^x):}

Subtract first equation from second: -1/2c_2'e^(1/2 x)=1/2e^x or c_2=-e^(1/2 x) .

From first equation c_1'=-c_2'e^(-1/2x)=-(-e^(1/2 x))e^(-1/2 x)=1 .

So, c_1=int 1dx=x and c_2=int -e^(1/2 x)dx=-2e^(1/2 x) .

Therefore, y_p=c_1e^x+c_2e^(1/2 x)=xe^x-2e^x .

Finally, y=y_h+y_p=c_1e^x+c_2e^(1/2 x)+xe^x-2e^x=c_3e^x+c_2e^(1/2 x)+xe^x where c_3=c_1-2 .

Example 3. Find general solution of y'''+y'=1/(cos(x)) .

Solution of the corresponding homogeneous equation is y_h=c_1+c_2cos(x)+c_3sin(x) .

To find particular solution set up system:

{(c_1'*1+c_2'cos(x)+c_3'sin(x)=0),(c_1'*(1)'+c_2'(cos(x))'+c_3'(sin(x))'=0),(c_1'*(1)''+c_2'(cos(x))''+c_3'(sin(x))''=1/(cos(x))):}

Or

{(c_1'+c_2'cos(x)+c_3'sin(x)=0),(-c_2'sin(x)+c_3'cos(x)=0),(-c_2'cos(x)-c_3'sin(x)=1/(cos(x))):}

Solving this system gives c_1'=1/(cos(x)),\ c_2'=-1,\ c_3'=-tan(x) .

So,

c_1=int 1/(cos(x))dx=ln(|(1+sin(x))/(cos(x))|)

c_2=int -1dx=-x

c_3=int -tan(x)dx=ln(|cos(x)|) .

Thus, y_p=c_1+c_2cos(x)+c_3sin(x)=ln(|(1+sin(x))/(cos(x))|)-xcos(x)+ln(|cos(x)|)sin(x) .

Finally, general solution is

y=y_h+y_p=c_1+c_2cos(x)+c_3sin(x)+ln(|(1+sin(x))/(cos(x))|)-xcos(x)+ln(|cos(x)|)sin(x)