# Preface

This is a
tutorial made solely for the purpose of education and it was designed
for students taking Applied Math 0330. It is primarily for students who
have very little experience or have never used
*Mathematica* before and would like to learn more of the basics for this computer algebra system. As a friendly reminder, don't forget to clear variables in use and/or the kernel.

Finally, the commands in this tutorial are all written in bold black font,
while *Mathematica* output is in normal font. This means that you can
copy and paste all commands into *Mathematica*, change the parameters and
run them. You, as the user, are free to use the scripts for your needs to learn the *Mathematica* program, and have
the right to distribute this tutorial and refer to this tutorial as long as
this tutorial is accredited appropriately.

Return to computing page for the second course APMA0340

Return to Mathematica tutorial for the second course APMA0330

Return to Mathematica tutorial for the first course APMA0340

Return to the main page for the course APMA0340

Return to the main page for the course APMA0330

Return to Part IV of the course APMA0330

# Variation of Parameters

We present the most general and powerful method for solving nonhomogeneous linear differential equations---**variation of parameters** method.
It can be used for arbitrary driving functions in opposite, for instance, to the method of undetermined coefficients that requires a specific form
of input functions and could be applied mostly for constant coefficient equations. Variation of parameters method can be used
to solve arbitrary linear differential equation with integrable input functions, including piecewise continuous functions.
However, practical application of the method may be limited because it needs a lot of calculations and integrations and requires explicit knowledge
of a fundamental set of solutions for the associated homogeneous equation.

The method of variation of parameters was introduced by Leonhard Euler (1707--1783) and completed by his follower Joseph-Louis Lagrange (1736--1813). However, the variation of parameters method is actually an extension for higher order differential equation the Bernoulli method that is used to solve linear equations and the Bernoulli equations. In his 1749 study of the motions of the earth, Euler obtained differential equations for the orbital elements; and in 1753 he applied the method to his study of the motions of the moon. Lagrange first used the variation of parameters method in 1766 and applied it to solve some problems from celestial mechanics. It should be noted that Euler and Lagrange applied this method to nonlinear differential equations and that, instead of varying the coefficients of linear combinations of solutions to homogeneous equations, they varied the constants of the unperturbed motions of the celestial bodies. During 1808--1810, Lagrange gave the method of variation of parameters its final form in a series of papers.

Joseph-Louis Lagrange born Giuseppe Lodovico Lagrangia or Giuseppe Ludovico De la Grange Tournier (1736--1813) in Turin, Piedmont-Sardinia (now Italy). Lagrange was of Italian and French descent. Lagrange’s life divides very naturally into three periods. The first comprises the years spent in his native Turin (1736--1766). The second is that of his work at the Prussian Academy of Sciences in Berlin, between 1766 and 1787. He succeeded the director of mathematics position from Leonhard Euler (who returned to Russia and strongly recommended Joseph-Louis) and gained the full support of d'Alembert. The thirds finds him in Paris, from 1787 until his death in 1813.

The first two periods were the most fruitful in terms of scientific activity, which began as early as 1754 with the discovery of the calculus of variations and continued with the application of the latter to mechanics in 1756. He also worked in celestial mechanics in this first period, stimulated by the competitions held by the Paris Academy of Sciences in 1764 and 1766. The Berlin period was productive in mechanics as well as in differential and integral calculus. Yet during that time Lagrange distinguished himself primarily in the numerical and algebraic solution of equations, and even more in the theory of numbers. ■

We start the method with a second order nonhomogeneous linear differential equation

*p(x)*,

*q(x)*, and

*f(x)*are given functions provided that

*p*and

*q*are continuous in some interval; the input function

*f(x)*is assumed to be integrable within this interval (so it could be piecewise continuous). The variation of parameters method is applicable only when the fundamental set of solutions for associated homogeneous equation \( y'' + p(x)\, y' + q(x)\, y = 0 \) is known. Thus, we assume that

*y*

_{1}and

*y*

_{2}are known two linearly independent solutions of the homogeneous equation:

*A(x)*and

*B(x)*are some two smooth functions to be determined. Upon differentiating the above function, we get

*A(x)*and

*B(x)*are arbitrary functions, we impose the condition on them:

*A*and

*B*do not participate in the product rule. This allows us to find the second derivative

*A(x)*and all terms associated with

*B(x)*, we obtain

*y*

_{1}and

*y*

_{2}, respectively. Then we rearrange terms to obtain

*y*

_{1}and

*y*

_{2}are two linearly independent solutions of the homogeneous equation, \( L \left[ x, \texttt{D} \right] y_1 =0 \) and \( L \left[ x, \texttt{D} \right] y_2 =0 , \) we get

*A'*and

*B'*is usually referred to as the Lagrange system. Solving the system, we get

*C*

_{1}and

*C*

_{2}are constants of integration. Here

*x*

_{0}is an arbitrary point from the domain where the Wronskian is not zero, and ξ is a dummy variable of integration. Being able to determine the coefficients

*A(x)*and

*B(x)*, we construct the solution of the given nonhomogeneous differential equation

*An Essay on the Application of Mathematical Analysis to the Theories of Electricity and Magnetism*(Green, 1828). The essay introduced several important concepts, among them a theorem similar to the modern Green's theorem, the idea of potential functions as currently used in physics, and the concept of what are now called Green's functions. Green's life story is remarkable in that he was almost entirely self-taught. He received only about one year of formal schooling as a child, between the ages of 8 and 9.

## Third order Differential Equations

Now we turn our attention to higher order differential equations. Let us consider the third order one:

*W(x)*is the Wronskian of the fundamental set of solutions:

Example: Our first example concerns constant coefficient equation

*A(x)*and

*B(x)*satisfy the Lagrange system of algebraic equation:

Example: Consider nonhomogeneous differential equation with variable coefficients

*A(x)*and

*B(x)*are to be determined from the Lagrange system of equations:

Example: Consider the third order differential equation

*W(x)*is the Wronskian of the fundamental set of solutions:

*C*

_{1},

*C*

_{2}, and

*C*

_{3}are arbitrary constants, we obtain the general solution:

Return to Mathematica page

Return to the main page (APMA0330)

Return to the Part 1 (Plotting)

Return to the Part 2 (First Order ODEs)

Return to the Part 3 (Numerical Methods)

Return to the Part 4 (Second and Higher Order ODEs)

Return to the Part 5 (Series and Recurrences)

Return to the Part 6 (Laplace Transform)

Return to the Part 7 (Boundary Value Problems)