HomeARITHMETICApplying the Finite Difference...

Applying the Finite Difference Method to Boundary-Value Problems 1 |

Applying the Finite Difference Method to Boundary-Value Problems 1 |

The finite difference method is a widely used technique for solving boundary-value problems. It approximates the derivatives in the differential equations using finite differences, thereby converting the differential equations into a system of algebraic equations. By solving these algebraic equations, one determines the values of the dependent variable at specific discrete points of the independent variable.

To demonstrate this approach, let’s solve the following second-order linear two-point boundary-value problem:

\displaystyle \begin{cases} p(x) y''(x) + q(x) y'(x)+r(x) y(x) = s(x) \\ \alpha_0y(a) + \beta_0 y'(a) = \gamma_0 \\ \alpha_1 y(b) + \beta_1 y'(b) = \gamma_1 \end{cases}

We begin by dividing the interval [a, b] into n subintervals, each of length h=\frac{b-a}{n}, by the grid points

x_0 = a, x_1=a+h, ..., x_i = x_0+i h, ..., x_n=b.

Next, we approximate the unknown function y(x) at these mesh points. By replacing the derivatives y''(x) and y'(x) with their finite difference approximations from “Deriving Finite Difference Approximations of the Derivatives“:

y'(x_i) = \frac{y(x_{i+1})-y(x_{i})}{h} + O(h),

y'(x_i) = \frac{y(x_{i+1})-y(x_{i-1})}{2h} + O(h^2),

y''(x_i) = \frac{y(x_{i+1})-2y(x_i) + y(x_{i-1})}{h^2} + O(h^2),

we obtain the following relationships that the solution must satisfy:

\displaystyle \begin{cases} p(x_i)\frac{y(x_{i+1})-2y(x_{i})+y(x_{i-1})}{h^2} + q(x_i)\frac{y(x_{i+1})-y(x_{i-1})}{2h}+r(x_i)y(x_i) \approx s(x_i), \quad 1 \le i \le n-1\\ \alpha_0 y_0 + \beta_0 \frac{y_1-y_0}{h} \approx \gamma_0 \\ \alpha_1 y_n + \beta_1\frac{y_{n}-y_{n-1}}{h} \approx \gamma_1.\end{cases}

Suppose that we can find numbers y_0, y_1, ... , y_{n-1}, y_n that satisfy the equations:

\begin{cases} \displaystyle p_i\frac{y_{i+1}-2y_i+y_{i-1}}{h^2} + q_i\frac{y_{i+1}-y_{i-1}}{2h}+r_i y_i = s_i,  \quad 1 \le i \le n-1 \\ \alpha_0 y_0 + \beta_0 \frac{y_1-y_0}{h} = \gamma_0 \\ \alpha_1 y_n + \beta_1\frac{y_{n}-y_{n-1}}{h} = \gamma_1 \end{cases}\quad\quad\quad(*)

where p_i = p(x_i), q_i = q(x_i), r_i = r(x_i) and s_i = s(x_i).

Then we can consider y_0, y_1..., y_{n-1}, y_{n} to be the approximations of the solution y(x) at the the grid points x_0, x_1, ... , x_{n-1}, x_n.

Furthermore, (*) can be rewritten as:

\displaystyle \begin{cases} \left(\alpha_0 -\frac{\beta_0}{h}\right)y_0 + \frac{\beta_0}{h}y_1 = \gamma_0 \\p_i\frac{y_{i+1}-2y_i+y_{i-1}}{h^2} + q_i\frac{y_{i+1}-y_{i-1}}{2h}+r_i y_i = s_i, \quad 1 \le i \le n-1 \\ -\frac{\beta_1}{h}y_{n-1} + (\alpha_1 + \frac{\beta_1}{h})y_n = \gamma_1\end{cases}

This forms a system of n+1 linear equations in the n+1 unknowns y_0, y_1, ..., y_{n-1}, y_{n}. In matrix form it is:

\displaystyle \begin{pmatrix} \alpha_0-\frac{\beta_0}{h} & \frac{\beta_0}{h} & & & & \\ \ddots & \ddots & \ddots & \\ & \frac{p_{k}}{h^2}-\frac{q_{k}}{2h}& \frac{-2p_{k}}{h^2}+r_{k}& \frac{p_{k}}{h^2}+\frac{q_{k}}{2h} \\ & \ddots & \ddots & \ddots \\& & -\frac{\beta_1}{h} & \alpha_1+\frac{\beta_1}{h}\end{pmatrix} \begin{pmatrix} y_0 \\ \vdots \\ y_k \\ \vdots \\y_{n} \end{pmatrix}

= \begin{pmatrix} \gamma_0 \\ \vdots \\ s_k \\ \vdots \\ \gamma_1\end{pmatrix}

Solving this system of linear equations yields y_i for 0 \le i \le n.


Exercise-1 Show that discretizing the boundary-value problem

\displaystyle \begin{cases} p(x) y''(x) + q(x) y'(x)+r(x) y(x) = s(x) \\ y(a) = \alpha \\ y(b) = \beta\end{cases}

leads to the following system of linear equations:

\displaystyle \begin{pmatrix} 2p_1-r_1 h^2& -p_1-\frac{q_1}{2}h\\ \ddots & \ddots & \ddots \\ & -p_{k}+\frac{q_{k}}{2}h & 2p_{k}-r_{k}h^2 & -p_k-\frac{q_k}{2}h\\ & \ddots & \ddots & \ddots\\ & & -p_{n-1}+\frac{q_{n-1}}{2}h & 2p_{n-1}-r_{n-1}h^2&\end{pmatrix} \begin{pmatrix} y_1 \\ \vdots \\y_k \\ \vdots \\ y_{n-1} \end{pmatrix}

\displaystyle = \begin{pmatrix} -s_1 h^2+(p_1-\frac{q_1}{2}h)\alpha \\ \vdots \\ -s_k h^2 \\ \vdots \\ -s_{n-1}h^2 + (p_{n-1}+\frac{q_{n-1}}{2}h)\beta\end{pmatrix}

Exercise-2 Show that a more accurate approximation of boundary conditions is given by

\displaystyle \alpha_0 y_0 + \beta_0\frac{-3y_0+4y_1-y_2}{2h}=\gamma_0\quad\quad\quad(1)

\displaystyle \alpha_1 y_1 + \beta_1\frac{y_{n-2}-4y_{n-1}+3y_n}{2h} = \gamma_1\quad\quad\quad(2)

Exercise-3 Deriving the system of linear equations by discretizing boundary conditions using (1) and (2).

Exercise-4 Show that |y_i - y(x_i)| \le O(h^2).


Most Popular

More from Author

Google Forms for Formative Assessment in Math Class

Cheers to a new school year that will be unlike any...

2nd Grade Subtraction Worksheet | Subtraction of 2-Digit Numbers

In 2nd grade subtraction worksheet we will solve the problems on subtraction...

S01 overview – Intellectual Mathematics

Galileo is the most overrated figure in the history of science....

Digital SAT Math Problems and Solutions (Part

Problem 1 :Store A sells raspberries for $5.50 per pint and...

- A word from our sponsors -

Read Now

Google Forms for Formative Assessment in Math Class

Cheers to a new school year that will be unlike any school year before!I know that all of us are looking at new and different plans...hybrid/synchronous/asynchronous/ fully in person/fully remote...the list goes on.   I have spent a considerable amount of time trying to figure out how I...

2nd Grade Subtraction Worksheet | Subtraction of 2-Digit Numbers

In 2nd grade subtraction worksheet we will solve the problems on subtraction of 2-digit numbers (without Regrouping), subtraction of numbers with regrouping, subtracting 1-digit number from 2-digit number with regrouping, subtracting 2-digit number with regrouping, checking subtraction with addition, subtraction is reverse of addition, addition and subtraction together, estimating the difference and...

S01 overview – Intellectual Mathematics

Galileo is the most overrated figure in the history of science. That is the thesis of Season 1 of my podcast, which consists of the following 18 episodes. Galileo bad, Archimedes good Galileo’s bumbling attempts at determining the area of the cycloid suggests a radical new interpretation of...

Digital SAT Math Problems and Solutions (Part

Problem 1 :Store A sells raspberries for $5.50 per pint and blackberries for $3.00 per pint. Store B sells raspberries for $6.50 per pint and blackberries for $8.00 per pint. A certain purchase of raspberries and blackberries would cost $37.00 at store A or $66.00 at store B. How many...

How To Find The Factors Of 20: A Simple Way

The factors of 20 are the numbers 1, 2, 4, 5, 10, 20, -1, -2, -4, -5, -10, and -20. As you can see, the total number of factors 20 has is 12. Make the following observations!The numbers 1, 2, 4, 5, 10, 20 are called positive factors of...

Addition & Subtraction Together |Combination of addition & subtraction

We will solve the different types of problems involving addition and subtraction together. To show the problem involving both addition and subtraction, we first group all the numbers with ‘+’ and ‘-‘ signs. We find the sum of the numbers with ‘+’ sign and similarly the sum of all the...

Two Back to School Ideas for Digital Classrooms

 Yep, it's a school year like no other.  If you're like me, you have some very specific back to school routines...you buy the new school supplies, you get your kids a new backpack, you prepare your bulletin boards.  There are even back to school activities that I...

Digital SAT Math Problems and Solutions (Part

Problem 1 :Each face of a fair 14-sided die is labeled with a number from 1 through 14, with a different number appearing on each face. If the die is rolled one time, what is the probability of rolling a 2? Solution : https://www.youtube.com/watch?v=PC0RAjG6Zb8 Problem 2 :A printer produces posters...

Percent of Increase Word Problems

Hello and welcome! We're focusing today on a fascinating mathematical topic: percent of increase word problems. We've got some exciting scenarios to consider and we'll walk through these calculations together. It'll be as simple as counting 1, 2, 3. Let's start! Before we start, let's be clear on...

Societal role of geometry in early civilisations – Intellectual Mathematics

Podcast: DownloadIn ancient Mesopotamia and Egypt, mathematics meant law and order. Specialised mathematical technocrats were deployed to settle conflicts regarding taxes, trade contracts, and inheritance. Mathematics enabled states to develop civil branches of government instead of relying on force and violence. Mathematics enabled complex economies in which...

Sub Plans for High School Math Class – Webquests are Perfect!

Distance learning ... hybrid learning ... asynchronous learning ...   we're all learning different terms right now!  Here is a type of activity would be great in any of these settings...Webquests!I have used these types of activities in my classroom for a number of years.  I enjoy using...

Digital SAT Math Problems and Solutions (Part

Problem 1 :A neighborhood consists of a 2-hectare park and a 35-hectare residential area. The total number of trees in the neighborhood is 3,934. The equation 2x + 35y = 3,934 represents this situation. Which of the following is the best interpretation of x in this context? A) ...