# How to Solve a First-Order Differential Equation in Excel (Easy Steps)

## Understand Differential Equations

• A differential equation relates one or more functions to their derivatives with respect to an independent variable.
• The highest order of the derivative determines the order of the differential equation.
• Differential equations are used to model growth, decay, and various phenomena, including physics applications.

## Problem Statement

• Given the differential equation:

dy/dx=f(x)
• Initial condition:

• We want to compute the values of

in the time interval

.

### STEP 1 – Create Dataset

• Create a dataset to insert the iteration number (n), time value (t), y value, yexact value, and delta_t.
• The delta_t is the separation value.
• Display the equations to find the t(n+1) and y(n+1) values.
• Add the time interval and initial value to make the calculation easy.

### STEP 2 – Apply Formula for Time Values & Y-values

• Apply formulas to calculate the time values and y-values.
• At the start of the iteration, n is 0, t is 0, and y is 5.
• Insert these values in Cells B5, C5, and D5Â respectively.

• Insert a formula to calculate the t-values.
• Select Cell C6 and enter the formula below:
=C5+$G$5
• Press Enter.

• To find the y-values:
• Select Cell D6 and enter the formula below:
=D5+(C5-D5)*$G$5
• Press Enter to see the result.

### STEP 3 – Fill Columns

• To fill the values in the n, t, and yÂ columns:
• To find the number of iterations (n), divide the time interval by the delta_t value.
• In this problem statement the iteration number (n) = (2/0.1) = 12.
• Fill the iteration column from 0 to 12.

• Select both Cells C6 & D6 and drag the Fill HandleÂ down.

• The t and yvalues have been calculated.

### STEP 4 – Plot Data

• To plot the t and yvalues, select the range C4:D17.

• Go to the Insert tab and click on the Insert Scatter icon. A drop-down menu will appear.
• Select Scatter with Lines.

• As a result, a chart will display on the sheet.
• Change the chart title according to your preferences.

### STEP 5 – Format Axis

• To format the axis of the graph:
• Doubleclick on the horizontal axis. It will open the Format Axis options on the right side of the sheet.
• Set the Minimum value to 0 and Maximum value to 1.2 in the Bounds section.
• Press Enter.

• Doubleclick on the vertical axis.
• Set the Minimum value to 0.3 and Maximum value to 0.65 in the Bounds section.
• Press Enter.

• The graph will look like the picture below:

### STEP 6 – Find the Exact Solution

• The exact solution of the differential equation is y = -1 + t + 1.5*exp(-t).
• Select Cell E5 and enter the formula below:
=-1+C5+1.5*EXP(-C5)

• Press Enter and drag the Fill HandleÂ down.

• The y-values of the exact solution have been calculated.

### STEP 7 – Plot the Exact Solution on the Same Chart

• To compare the y-values of the exact solution with the numerical values, plot them on the same chart.
• Rightclick on the chart to open the menu.
• Click on the Select DataÂ option.

• In the Select Data Source dialog box, click on Add.

• Insert the Series X and Y values in the Edit SeriesÂ box.

• Click OK to get the plot of the exact solution.

### Final Output

• If the delta_t value in Cell G5 is changed, the whole dataset will automatically update and show the solution for the updated delta_tÂ value.

• The graphs will also update automatically.

## Related Articles

<< Go Back to Excel Solve Equation | Excel Solver ExamplesÂ |Â Solver in ExcelÂ |Â Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mursalin Ibne Salehin

Mursalin Ibne Salehin holds a BSc in Electrical and Electronics Engineering from Bangladesh University of Engineering and Technology. Over the past 2 years, he has actively contributed to the ExcelDemy project, where he authored over 150 articles. He has also led a team with content development works. Currently, he is working as a Reviewer in the ExcelDemy Project. He likes using and learning about Microsoft Office, especially Excel. He is interested in data analysis with Excel, machine learning,... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF