Investigating Integrals with Geogebra

Solving a problem from the Classical Mathematics Group

April 17, 2024 · John Peach

Have you ever wondered how mathematicians calculate the area of curved shapes? While finding the area of a rectangle is straightforward - just multiply length by width - what happens when we’re dealing with curves that bend and twist? This is where one of calculus’s most powerful tools comes into play: integration.

In the previous article, CAS with Geogebra we looked at derivatives. Here we’ll go in the opposite direction and investigate integrals. If you have a function f(x)f(x) then the derivative is written as f(x)f'(x) and gives the slope of the function at any point xx. Integration reverses this process and gives you f(x)f(x) from the derivative function f(x)f'(x).

Integration isn’t just an abstract mathematical concept - it is used in many practical applications. In physics, integrating the velocity of an object gives the total distance travelled, and in engineering you could integrate the height of the water in Lake Mead to determine the force on the Hoover Dam. Mathematically, integration is done by summing up the areas of infinitely many rectangles with infinitesimally small widths. Let’s take a look at how this works with an example.

The Integral

The way the integral is calculated is to find the area of small rectangles under the curve of f(x)f(x). Suppose f(x)=xx3f(x) = x-x^3 and we want to find the area of a small rectangle centered at x=0.32x = 0.32 that has a width of Δx=0.4\Delta x = 0.4.

example-integral
Figure 1.

The area under the curve.

Calculating the value of ff at 0.320.32 gives f(0.32)=0.287f(0.32) = 0.287, and since the width of the rectangle is 0.40.4 the area is A=f(x)Δx=0.2870.4=0.115.A = f(x) \Delta x = 0.287 \cdot 0.4 = 0.115. Now imagine repeating this from 00 to 11 along the xx-​axis. Add up all of the areas of the rectangles and you’ll get an approximation for the total area under the curve, called the Riemann sum.

riemann-sum
Figure 2.

Riemann sums - function integration.

Alexander Bogomolny built an interactive demonstration of Riemann sums on his website Cut the Knot where you can choose several different functions, select left, midpoint, or right ends for the height of the rectangles, and set the width of the rectangles to see how your choices affect the estimated area.

Using the summation symbol we can write

F(x)=i=1nf(xi)ΔxF(x) = \sum_{i=1}^n f(x_i) \Delta x

where xix_i is the location of the center of the ithi^{th} rectangle, and F(x)F(x) represents the total area.

But, the area under the curve is just a number and the integral is a function. Is this like the wave-particle duality of photons? No, the answer is much simpler. The integral becomes an area if you measure between two points along the xx-axis. In the first example, we might start at x=0x=0 and end at x=1x=1. If the curve is above the xx-axis the area is a positive number and if it’s below then the area is negative.

If the beginning and endpoints aren’t given, then the integral is a function. It’s the function F(x)F(x) that has a derivative f(x)f(x), so we’d like a procedure that finds FF from ff.

Techniques of Integration

Finding the integral of a function is often tricky and may involve substituting a variable for a term in the function, using rules from trigonometry, or applying something called integration by parts. Sometimes you can find the solution in a table of integrals or you may resort to a computer algebra system like WolframAlpha or the Geogebra CAS. For the cubic polynomial above, Geogebra finds the integral,

geogebra-cas-integration
Figure 3.

Geogebra CAS integral.

The function that is the integral of f(x)=xx3f(x) = x - x^3 is

F(x)=x44+x22+cF(x) = -\frac{x^4}{4} + \frac{x^2}{2} + c

where cc is called the constant of integration (Geogebra uses c1c_1). The integral function looks like

geogebra-integral-function
Figure 4.

Integral of the cubic function.

which has slope f(x)f(x) at every point xx. Since the constant cc shifts the function up or down the yy-axis it won’t change the shape of the curve, so the derivative remains the same.

A more difficult integral problem

A problem that requires a bit more thought is this:

integral-problem
Figure 5.

An integral problem: Find the area of the colored region.

What is the area in the colored region? An assumption made by people in the Classical Mathematics group is that the white rectangle is a square, but you know what they say about assumptions - they make an ass out of u and mptions.

Let’s split the area into two pieces. Let ATA_T be the total area above the curve y=αx2y=\alpha x^2 and below the line y=1y=1, and ARA_R be the area of the white rectangle. Since the figure is symmetric about the yy-axis, we can start everything at x=0x=0 and just double the areas.

To get the area in the colored region ATA_T, we can calculate the area below y=1y=1 and subtract the area below y=αx2y= \alpha x^2, so f(x)=1αx2f(x) = 1 - \alpha x^2. Using the Geogebra CAS, the integral is

F(x)=xα3x3+c.F(x) = x - \frac{\alpha}{3}x^3 + c.

From the Fundamental Theorem of Calculus, the area enclosed by f(x)f(x) over an interval [a,b][a,b] is F(b)F(a)F(b) - F(a), or the difference of the integral function at the endpoints of the interval. In this case, a=0a = 0 and (ignoring the integration constant cc) F(0)=0F(0) = 0.

What’s the value of bb? That is, where does y=αx2y= \alpha x^2 intersect y=1y=1? It has to be where αx2=1\alpha x^2 = 1 so at x=1αx = \frac{1}{\sqrt{\alpha}}. In mathematical notation,

AT(α)=2x=01αf(x)dx=2x=01α1αx2dx=2(xα3x301α).A_T(\alpha) = 2\int_{x=0}^{\frac{1}{\sqrt{\alpha}}} f(x) dx = 2\int_{x=0}^{\frac{1}{\sqrt{\alpha}}} 1 - \alpha x^2 dx = \left. 2 \left( x - \frac{\alpha}{3} x^3 \right|_{0}^{\frac{1}{\sqrt{\alpha}}} \right).

The integral symbol \int is used to denote the Riemann sum when the width of the rectangles dxdx approaches zero. The line at the end with 00 at the bottom and 1α\frac{1}{\sqrt{\alpha}} at the top is the notation to tell us to evaluate the integral at the endpoints. Doing the evaluation gives,

AT(α)=2(1αα31α3/2)0=2(1α131α)=431α.\begin{aligned} A_T(\alpha) &= 2\left( \frac{1}{\sqrt{\alpha}} - \frac{\alpha}{3} \frac{1}{\alpha^{3/2}} \right) - 0 \\ &= 2 \left( \frac{1}{\sqrt{\alpha}} - \frac{1}{3}\frac{1}{\sqrt{\alpha}} \right) \\ &= \frac{4}{3} \frac{1}{\sqrt{\alpha}}. \end{aligned}

The area in the white rectangle depends on the location of the point pp, and the area of the rectangle is

AR(p)=2p(1αp2).A_R(p) = 2p(1-\alpha p^2).

The area in the colored region is the difference

A(p,α)=AT(α)AR(p)=431α2p(1αp2).A(p,\alpha) = A_T(\alpha) - A_R(p) = \frac{4}{3} \frac{1}{\sqrt{\alpha}} - 2p(1-\alpha p^2).

If we set α=1\alpha = 1, then the area becomes A(p)=432p(1p2)A(p) = \frac{4}{3} - 2p(1-p^2).

geogebra-F(p)
Figure 6.

The area of the colored region as a function of pp.

Notice that at p=0p=0 and p=1p=1 the area of the white rectangle is zero and the colored region has area A=43A = \frac{4}{3} shown by the green line.

One last question is, what is the value of pp that makes the white rectangle a square, and what is the value of AA at that point? For the rectangle to be a square the length of the side from f(p)f(p) to the line y=1y=1 must be equal to two times pp since pp is only half the length of one side of the square. This means,

2p=1f(p)=1αp2.2p = 1-f(p) = 1 - \alpha p^2.

Rearranging this equation gives a quadratic,

αp2+2p1=0\alpha p^2 + 2p -1 = 0

with solutions

p=12α(2±44α(1))=1α(1±α+1).p = \frac{1}{2 \alpha} \left(-2 \pm \sqrt{4 - 4 \alpha (-1)} \right) = \frac{1}{\alpha} \left(-1 \pm \sqrt{\alpha + 1} \right).

Substituting this into the equation for the area A(p,α)A(p,\alpha)​,

geogebra-solution
Figure 7.

The Geogebra solution.

using the positive root for pp.

Integrating all the pieces

We’ve seen how integration works through the application of Riemann sums, and how Geogebra can be a useful tool towards solving integral problems. Now that you know how to calculate the integral of a function you should be able to extend the idea to many other areas besides mathematics.

calvin-and-hobbes-calculus

Software

Image credits