Gamma function

Math “minimalist”

It is always impressive when you see a chef who can create a fabulous dish with a minimum of ingredients. This is where their creativity shines, like when making a ganache using only chocolate and cream—really simple yet really good. Less is sometimes more.

Likewise, we have been doing creative work in Lazarus Math, and often with what I consider as minimum “input.” Notice the harmonic series simply begins with the natural numbers 1, 2, 3, etc. We use the idea of a fraction or division and write these numbers as a denominator. Next, we use good old-fashioned addition to sum these parts together. We use basic ingredients and basic functions.

We considered the pattern we created in the counting world and tried to replicate the pattern in the continuous world. This is where we identified the extremely simple expression of 1x\frac{1}{x}, where xx is a positive real number. Remember we considered this function because we compared the positive integers to the positive reals where both lived in the denominator with the simple number 1 resting in the numerator. We refer to 1 as a multiplicative identity, which just means that when we multiply by 1, we don’t change the number. We needed some number as the numerator, and 1 was the most basic choice.

Next, we identified how to take these simple expressions, represented them as graphs on the xyxy-coordinate system, and compared the area between these two graphs and the xx-axis. What could be simpler, more basic, and yet profound? The simple part involves our ingredients, our input, which are positive numbers flowing smoothly left to right. Because the numbers themselves have no limit, perhaps it is not a surprise that the areas under their graphs also have no limit. This was true for both the discrete input, the positive integers, and the continuous input, the positive real numbers.

As we stretched two infinite areas to their limits, we chose the creative step and took the difference between the two infinities. The end result was a newfound (new to me at least) irrational number that seemingly became a star overnight. The numbers π\pi and ee have been famous for some time, but how many of us have heard of the Euler-Mascheroni constant before? How would we describe the “birth” of this number?

We identified π\pi is “birthed” from a circle and ee is “birthed” from the exponential process. Would we say that the Euler-Mascheroni constant is the bridge between our continuous world and our countable world? Perhaps we can think of the Euler-Mascheroni constant as the difference between these two worlds? Perhaps we can think of it as something that connects counting to measuring.

However we visualize this number, we learned that the Euler-Mascheroni constant reappears in math in strange places. It is not just an ordinary number lying innocently between 0.57 and 0.58 on our number line.

Factorial defined

Both of the graphs we have reviewed decrease as we move left to right. This is because our numbers that increase were resting in the denominators of the fraction. From basic math, we know a fraction decreases as the denominator increases when the numerator remains a constant 1.

In this section, we will continue to use positive numbers as input. But this time we place these input numbers in the numerator. This move will produce the opposite result and cause our graph to increase as we move left to right. We will even magnify the increase by ushering in a multiplication process. We are not concerned about the limit or the “destination” of this process as it will blow up quite quickly. But we are interested to learn about the “journey” of this process—what happens at each step.

Our first item to address is understanding this multiplication process.

This process is one that you may already be familiar with, at least in principle. In the last section, we retrieved our calculator and identified the somewhat hall-of-fame status given to the natural log function. Another button likely strutting proudly on your calculator is x!x!. It’s nice to see an exclamation point in math. However, it doesn’t mean strong feelings or a point of emphasis but represents repeated multiplication. The expression, or notation, x!x! is also given a fancy name. We refer to x!x! as “xx factorial.”

The way the math works, if we input 5 as xx, then x!x! is 5×4×3×2×15 \times 4 \times 3 \times 2 \times 1. Technically, we start at 0!0! where 0!=10!=1 by definition. We focus on positive integers, so next is 1!1!, which is 1×0!=11 \times 0!=1. Notice we have this iterative process which allows us to write 2!=2×1!=22! = 2 \times 1! = 2. Likewise, 3!=3×2!=63! = 3 \times 2! = 6 . The factorial function appears a surprising number of times in life as well as math theory.

For example, if I want to count the number of ways I can choose 52 cards from a deck of cards, I have the entire deck to choose from for my first selection. After I choose 1 card, there are 51 cards remaining, so I have 51 cards to select from in my second selection. This process continues all the way down to 1 card at the end. To count the total number of ways this can occur, I multiply 52×51×50×...×1=52!52 \times 51 \times 50 \times ... \times 1=52! Obviously, this is a large number (8.0658×10678.0658 \times 10^{67}), and it is convenient to have a calculator button to quickly calculate this result. Then we can use this technique to calculate the probability of some event occurring by calculating the number of ways an event can occur and dividing it by the number of possible events. This method works if the probability of each event occurring is the same. Since this is a handy way to calculate probabilities, it is a common function used by actuaries who are in the business of calculating probabilities. But our focus in Lazarus Math is not on application, so let’s take a different look at this function.

If we want to see a picture of this function, we can graph the factorial operation for the first five positive integers where the horizontal axis is our input xx and the vertical axis is the result of applying the factorial process. Figure 1 shows the results for inputs up to x=5x=5.

Figure 1. Graphing the factorial function

Clearly, we can see this expanding quickly since 5!=1205!=120. If we input 10, we get 10!=3,628,80010!=3,628,800, so we are not going to consider where this function goes as xx approaches infinity, or even when xx becomes a “large” number. But we are interested in the nature or the properties of this function.

Notice we are using positive integers, the same input we used in the harmonic series in a previous section. We had an interesting journey when we identified a function similar to the harmonic series using positive real numbers instead as input. With that experience close in our rearview mirror, aren’t you a little curious to see if we can “connect the dots” by using positive real numbers as input? In other words, is there a way we can draw a curve, hopefully a nice smooth curve, that uses positive real numbers as input and connects these dots?

Those familiar with the factorial function know that if we try to input a non-integer into our calculator and apply the factorial function, we will get an error. In other words, if we enter 4.1 and then press the x!x! button, we likely will get an error message. Our calculator will say we are “coloring outside the lines,” meaning that the factorial is not defined for non-integer values.

This is true for the factorial button. But our curious mind may not be content to let the calculator determine what we can and cannot explore. Surely, we can identify a nice smooth curve to connect the dots similar to how we used the expression 1x\frac{1}{x} to create a smooth graph that connected the harmonic series. Since Lazarus Math is about exploring, why limit this neat function to only positive integers? Why can’t we invite all positive real numbers to the factorial party?

Connecting dots

Connecting the dots with smooth curves is a general thing that creative math minds do. Fortunately, other creative math minds have already done this work for us. This function is not a half-baked idea but one fully prepared. Here’s a graph of this function that connects the dots with a nice smooth curve.

Figure 2. Connecting the dots of the factorial function

It looks like this graph meets our objectives in that not only is it smooth but it also intersects our factorial output of integer values. Since this function seems to be a “keeper,” we are curious about the magical recipe that produces this graph. Before we reveal the “secret sauce” of the recipe, let’s start with a formal introduction.

Technically, this graph is not used in math, so it does not have a name. I am going to name it the “Continuous Factorial Function” since it takes the integer factorial function and makes it continuous. But this Continuous Factorial Function is closely related to a well-known function called the gamma function. The gamma function uses the uppercase Greek letter gamma, so it is written as Γ(x)\Gamma(x). The only difference between my Continuous Factorial Function and the gamma function is a shift of one unit for the input. I will use G(x)G(x) for the Continuous Factorial Function. Thus, we can connect these two functions by Γ(x)=G(x1)\Gamma(x)=G(x-1).

So we can shift the graph in Figure 2 one unit to the right to produce the gamma function starting at x=1x=1. The reason I am using the Continuous Factorial Function is because I want to simplify the idea of creating a smooth graph of the factorial function without having to make a shift in the input. Thus, the goal for using the Continuous Factorial Function is to make it easier to identify the connection between the discrete result and the continuous result. Because the Continuous Factorial Function and gamma function produce the same output after a shift, from a conceptual perspective, you can consider the two functions as the same thing.

You may notice we are reusing the term gamma. Recall we used the Greek letter gamma to represent the Euler-Mascheroni constant. The Euler-Mascheroni constant is also referred to as the gamma constant. But the gamma constant is a single number.

Now, we have the gamma function (or the near-equivalent Continuous Factorial Function). The gamma constant is not related to the gamma function, so do not think there is a connection between the two. To help distinguish between the gamma constant and the gamma function, let’s take a quick pause in our story to clarify what we mean in math by a “function.”

The function of a function

In math, a function takes a number as an input and produces a number as an output. The input number can be considered like an ingredient, and a function can be like a recipe that uses the ingredients, input, and generates an output. You can think of it as what comes out of the oven, the final result.

In more technical math terms, a function takes all values from one set and assigns them a unique value, which becomes the output set. You can think of the initial set as the set of inputs, and we often use the letter xx for the numerical value of the input. Then we think of the second set as the outputs, and we often use the letter yy to represent the numerical value of the output.

A more telling notation is f(x)f(x) rather than yy, where ff is a symbol for the function and xx is the input. Notice we can use letters other than ff for a function such as G and Γ\Gamma. Regardless of the notation for the function, the idea is the function is “acting on the input” in order to produce some specific output. If we input 3 and the function creates output 6 like we have in the factorial function, then we can write f(3)=6f(3)=6.

This assignment is not a random thing but something defined, so we know exactly how the inputs are assigned to an output. A function is like a verb that “acts on” the inputs. Normally, we think of performing some sort of math operation on the inputs, like adding, subtracting, multiplying, and dividing. We can even take square roots or exponentiate. We discussed before in Lazarus Math about how we can think of these operations as some sort of action. If we think of a function as performing some sort of math action, then we can use our creative minds to expand our function to perform action steps that are different from the usual math operations.

For example, in the previous section, we considered the natural log function. We can easily envision that as a simple function y=ln(x)y=ln(x). Remember, though, this is the same as calculating the area under a curve of the expression 1x\frac{1}{x}. That means if we input the number 4 into the function, we can calculate the natural log of 4 to produce a single output to the function. Alternatively, we can calculate the area under the graph y=1xy=\frac{1}{x} between x=1x=1 and x=4x=4 and output the same answer. The graph from our natural log section is shown below (Figure 3).

Figure 3. Area between x=1 and x=4 is ln(4)

The key point here is that this is another way we can define a function. Notice the action is calculating the area and the only “variable” in this action is where we stop calculating the area. So imagine calculating the area under the graph of y=1xy=\frac{1}{x} where we always start at x=1x=1 and then our “variable” is the xx value greater than 1 where we stop calculating the area. What makes this action a viable function is we will always get one and only one answer. For example, if we input 4 and thus calculate y=ln(4)y=ln(4), we get our specific result (approximately 1.38629436) by calculating the area under the graph y=1xy=\frac{1}{x} between 1 and 4. In the end, the function assigns the input 4 to the output 1.38629436.

Notice there are two functions involved—the original function and the area function. If we use our cooking example, we can say the area function is what produces the ganache and then we use the ganache as input to make something else, such as a truffle. The output from one set of ingredients becomes input into another dish that has its set of ingredients.

Using this two-function method to define the natural log function may seem interesting and creative, but it is easier to just take the natural log of the number to produce the same result. Of course, we could say that these two ways are really just one way because the definition of the natural log is calculating the area under the graph. But we are used to our calculator key that has the natural log function and it is easy to think of it as some separate “action.” It is like buying a premade truffle. Someone else has done all the work for you. You just need to input the cash to get it. So if you want to work with the natural log function “from scratch,” realize it is a two-function process.

The natural log is not the only example where a function is defined by calculating the area under a curve. There are other two-function processes, but they work slightly different. Another way we can do this is to fix the beginning and ending points where we calculate the area, then the “input” into the function is some parameter to the curve we are calculating the area for. In other words, we can change the function for which we are calculating the area but still calculate the area over the same input range.

The gamma and Continuous Factorial Functions use this creative process of calculating the area under a curve in its definition. But, rather than using the same area function and varying the ending point like the natural log, the gamma and Continuous Factorial functions change the area function and fixes both the beginning and ending points for which we calculate the area.

One more key property of a function is that even though we can write a function by using the variables xx and yy, a function is different from an equation. For example, we can write an equation for a circle with radius 1 centered at the origin as x2+y2=1x^2 + y^2=1. Then we can rearrange and solve for y=±1x2y=\pm \sqrt{1-x^2}. Notice for an input xx within the domain, we produce two output values for yy. This is not a function because a function only allows one output for a given input.

The Continuous Factorial Function defined

Returning to our story, we could input the variable xx into our Continuous Factorial Function just like we do with the factorial function. But let’s start with the specific input value 5 and feed 5 into the Continuous Factorial Function to see what it produces. Since 5 is an integer value and we know the Continuous Factorial Function produces the same result as the factorial function for positive integers, we anticipate the result of the Continuous Factorial Function will be 120 since 5!5! or 5×4!5 \times 4! or 5×4×3×2×1=1205 \times 4 \times 3 \times 2 \times 1 = 120.

Now that we have our input x=5x = 5 for our Continuous Factorial Function, we need an area curve where we assign 5 as a constant. Here is the area curve for the Continuous Factorial Function if we assign 5 as our constant:

x5ex\frac{x^5}{e^x}

Notice 5 is placed as an exponent. This is an interesting function worth analyzing. Since the variable xx occurs in both the numerator and denominator, it has a dual purpose. In the numerator, it serves as the base to an exponent, where the exponent is our input value. Then, in the denominator, xx is the exponent to base ee (of course!). We will analyze this expression in more detail in the next section. For now, our focus is simply using this expression.

As mentioned, the limits for where we calculate the area is fixed. We always calculate the area over the positive real numbers. Thus, we start at 0 and go all the way to infinity.

In Figure 4, we show the area under the curve from x=0x=0 to x=25x=25. The reason we stop at 25 in the illustration is there is not much area accumulating after x=15x=15 when we input 5.

Figure 4. Area graph with constant 5

This curve has a pleasing shape to it that is similar to a bell curve. However, the left tail has a fixed starting point at 0 which gives it an asymmetric look, like it is leaning a little to the left with a long right tail. We can loosely say the curve skews to the right. Remember the purpose of this curve is to calculate the area under this graph over an infinite range between x=0x = 0 and x=x = \infin. We know the result when we input integer 5 reproduces the factorial result 5!5!, thus the area equals exactly 120.

So to recap, let’s think about this in terms of your calculator. If you enter 5 and then press the x!x! button, your calculator returns 120. The likely way the calculator computes 120 is to take 5×4×3×2×1=1205 \times 4 \times 3 \times 2 \times 1 = 120. But an alternative way the calculator can produce the same result is to calculate the area under the graph of y=x5exy=\frac{x^5}{e^x}.

You may wonder how we calculate this area. We use the same secret sauce from calculus we have seen before that has tricks, methods, and madness to calculate the area under a curve. You will learn the details of this secret sauce when you learn calculus. But for those who have calculus and are interested, I provided a step-by-step solution at the end of this section.

The interesting point is again we are calculating the area under a curve to return the result for our function. This time our function is the Continuous Factorial Function, not the natural log function. Not only is calculating an area a creative way to define a function, but we’re again converting a two-dimensional result and reducing it to a single number. Notice area is an amount, something continuous, not something we count. But we can take the “amount” of the area and use it for a specific number we need.

Clearly, using this Continuous Factorial Function is a more complicated process than the factorial method to generate the result when we input 5. But, as we mentioned, our motivation for using the Continuous Factorial Function is we can produce results for all positive real numbers and not just positive integers. Since we are using an area function to generate our result, it should be no surprise that it works for non-integer input values since area is a continuous concept.

Comparing results for 4 and 5

Before we consider a non-integer input, let’s input 4 into our Continuous Factorial Function. Remember, the input 4 is a constant input into our area graph. What does this new graph look like?

Figure 5. Area with constant 4 and 5

In Figure 5, the graph for 4 is represented by a black curve. I preserved the Figure 4 graph for x=5x = 5 to show perspective. We change the 5 to a 4 in our previous formula, so 4 is the new constant in our area graph.

y=x4exy=\frac{x^4}{e^x}

Again, when we (calculus, actually) calculate the area starting at x=0x = 0 and extend it all the way to infinity for this new curve, the area is 24. Notice 24 is also the solution to 4!4!. With this setup, it’s not difficult to imagine repeating the process for an xx value that is not an integer. If you’re like me, you’re curious what this looks like for a constant halfway between 4 and 5.

Calculating the result for 4.5

Let’s start at the beginning to be sure we get the full story. We’re now embarking on answering the question we asked at the beginning. What is the value of our Continuous Factorial Function at a non-integer value, say 4.5? Remember in the beginning we presented the continuous curve that provided the results of our Continuous Factorial Function from 0 to 5. Figure 6 is the Continuous Factorial Function with the input 4.5 identified.

Figure 6. Continuous Factorial Function evaluated at x=4.5

What is the output for the Continuous Factorial Function if we input 4.5?

We follow our recipe. Let's return to our area graph and input 4.5 as a constant. We’ve seen this graph for a constant 4 and constant 5. What does the area graph look like when we consider a constant halfway between the two?

Do you expect the area value for x=4.5x = 4.5 to be halfway between the values for x=4x = 4 and x=5x = 5? Since our input is halfway between 4 and 5, that is a good guess. But, because of the shape of the curve, it appears the result will be a little less than halfway. Let’s follow our recipe to arrive at the exact result.

Figure 7 is the graph for the 3 constants we’ve considered: 4, 4.5, and 5. The black dashed line is the graph for the input 4.5. Again, it appears that the area of the graph is not quite half of the average of the areas of the graph of the constants 4 and 5.

Figure 7. Comparing the area functions with 3 different constants

Using the magic of calculus again, we can calculate the area under this graph to get our result. When the input to our Continuous Factorial Function is 4.5, the output is 52.34278 rounded to 5 decimal places. The average of 24 and 120 is 72, so the result is a little less than the average as we anticipated. Also, it’s not surprising we don’t get a nice integer result since we’ve wandered away from the safe and comfortable world of integer values. We’re now in the jungle of non-integer values, so we shouldn’t feel surprised to see a non-integer result.

To be honest, my intuition would be that we would produce a non-integer result for all input. However, the fascinating fact is that we do get an integer result for the area under the curve if we input any positive integer value. We know this because the area under the curve reproduces the factorial result for integer values which always produces an integer result. If you happen to digest the lengthy calculus solution at the end of this section, you will see why we get an integer result if we input an integer value.

Let’s return to the result for entering 4.5 as an input and ask if there a way we can make sense of the result 52.34278. Or is it just some random number that has no meaning?

Interpreting the result for 4.5

Recall when we enter an integer value into the factorial function, we can write the result as an iterative process. Since the gamma function reproduces the factorial function for integer values, we can state that if we enter 5 into the gamma function, we get 5!=5×4!5! = 5 \times 4!. Do we have an iterative process for non-integer values? If so, what is it? One way to answer these questions is to assume that we do have an iterative process and that it follows a process similar to the one we used for integers. Consider what this means at x=4.5x = 4.5.

Rather than writing the messy and incomplete result 52.34278 at 4.5, let’s give it a new name that removes the clutter. Let’s rename our result as G(4.5)G(4.5). Thus, G(4.5)G(4.5) represents the exact value, and it is approximately equal to our seemingly random number 52.34278.

The iterative process for an input xx into our Continuous Factorial Function would state: x!=x×(x1)!x! = x \times (x-1)!. Let’s use this same iterative process when xx is not an integer. That means the value at x=4.5x = 4.5 is 4.5 times the value we get at 1 less than 4.5. Using the same notation, we can write G(4.5)=4.5×G(3.5)G(4.5) = 4.5 \times G(3.5). We know the value of G(4.5)G(4.5), so we can solve for G(3.5)=G(4.5)/4.5=52.34278/4.5=11.63173G(3.5)=G(4.5)/4.5 = 52.34278/4.5=11.63173. Since we have a visual representation of the Continuous Factorial Function, we can zoom in on the graph from Figure 6, or just click on the graph at about x=3.5x=3.5 to determine whether this is a reasonable result. By inspection, it does appear to follow this process from 3.5 to 4.5. Feel free to try other numbers. The answer is that this iterative process does work for non-integer values. This shouldn’t be a surprise since the curve has a nice smooth continuous appearance—it doesn’t appear anything unusual occurs for an integer value input compared to a non-integer value input.

Notice this gives us a recipe for creating this graph once we get the first interval drawn. It isn’t practical to draw the entire curve since there are an infinite number of points on a curve. But it is practical to use this recipe for a single point such as G(4.5)G(4.5).

If we followed this recipe, we would not start at G(4.5)G(4.5) but would start at the first number starting on the left. Let’s write this process for G(4.5)G(4.5) from right to left to see where the first number is. Here is our pattern:

G(3.5)=3.5×G(2.5)G(3.5) = 3.5 \times G(2.5)

G(2.5)=2.5×G(1.5)G(2.5) = 2.5 \times G(1.5)

G(1.5)=1.5×G(0.5)G(1.5) = 1.5 \times G(0.5)

What is G(0.5)G(0.5)? Is G(0.5)G(0.5) the starting value? This would be the likely answer since we are using positive real numbers as input. If we allow real numbers as input, we can extend the input all the way to -1, but not including -1. The largest integer we use as input is 0 which we know produces the result 1. But all non-integer input values must be greater than -1. Thus, we need one more step back. The iterative process starts at G(0.5)G(-0.5). Therefore, we can perform one more iteration before we arrive at our seed value where we actually need to calculate something.

G(0.5)=0.5×G(0.5)G(0.5) = 0.5 \times G(-0.5)

We’ve now kicked the can down the street as far as we can. We have: G(4.5)=4.5×3.5×2.5×1.5×0.5×G(0.5)G(4.5) = 4.5 \times 3.5 \times 2.5 \times 1.5 \times 0.5 \times G(-0.5). We must now calculate G(0.5)G(-0.5). This means use the constant -0.5 in our area graph and calculate the area from 0 to infinity. Notice using -0.5 as input for our area graph does not cause a problem. Here is our area graph formula for the constant -0.5:

y=x0.5exy=\frac{x^{-0.5}}{e^x}

What is the area under this curve starting from x=0x = 0, which we notate as G(0.5)G(-0.5)?

Figure 8. Area graph with constant = -0.5

As you can see from Figure 8, there certainly is not a lot of area under this graph.

The area is approximately 1.772, or G(0.5)1.772G(-0.5)\approx 1.772. Again, we’re not surprised it is a messy result and seemingly uninteresting. As we often witnessed, we cannot be deceived by appearances as the exact result is anything but clutter.

The exact area under the graph of y=x0.5/exy=x^{-0.5}/e^x from x=0x = 0 to infinity is precisely the square root of π\pi, or G(0.5)=πG(-0.5)=\sqrt{\pi}.

Would you agree that this is too good to be true? No one can just make this stuff up. Perhaps you suspected π\pi was going to show up at this Continuous Factorial Function party? I know I did not see that coming.

Let’s digest the impact this has on our research. This also indicates we know the precise value of G(4.5)G(4.5). G(4.5)=4.5×3.5×2.5×1.5×0.5×πG(4.5)=4.5 \times 3.5 \times 2.5 \times 1.5 \times 0.5 \times \sqrt{\pi}.

As a result, our nice smooth curve does not only contain the factorial results we want at the integer values. For the values of xx halfway between integers, we have a “midpoint” integer factorial that starts withπ\sqrt{\pi}.

We’ve calculated the result for integer values and a non-integer value halfway between integers. Let’s quickly run through the recipe with one more example. Here is our recipe if we input 4.9. We know G(4.9)=4.9×3.9×2.9×1.9×0.9×G(0.1)G(4.9)=4.9 \times 3.9 \times 2.9 \times 1.9 \times 0.9\times G(-0.1). We can calculate the value of G(0.1)G(-0.1) by retrieving our area function and using the constant 0.1-0.1. Of course, we could calculate the area function directly at G(4.9)G(4.9) if we wanted to bypass this iterative process. Notice the advantage of the iterative process is we only need to calculate the area for values between x=1x = -1 and x=0x = 0. Then we can quickly calculate any other values using basic multiplication.

Summary

I marvel at how clever this idea is. To get the full breadth, let’s review our story.

We started with a simple formula for multiplying integers called factorial. We graphed the results for the first 5 integers. Then we had the curiosity to ask if there was a smooth graph that “connected the dots” between these integer values. There wasn’t an easy way to define this graph directly. Rather, we used an indirect route that defined an area function. The area function has this form:

y=xcexy=\dfrac{x^c}{e^x}

where c is some constant that we input.

This interesting function has the property that when we calculate the area under this new function from 0 to infinity for a given constant cc, it gives us the value of our Continuous Factorial Function at cc.

We can write this using the notation we’ve defined. If we want the result for G(c)G(c) where c is an input to our Continuous Factorial Function, the result is the area under the graph of y=xcexy=\dfrac{x^c}{e^x}. This produces an interesting relationship to our original Continuous Factorial Function where G(c)=c×G(c1)G(c)=c \times G(c-1) for any positive value for c.

Therefore, the Continuous Factorial Function is complete and ready for our hike upwards. We know it is steep, but it is smooth as displayed in Figure 9. Also, if we measure the distance we travel on a horizontal scale, we know at every integer value, we are also an integer value up vertically. That is not all. When we reach a midpoint between integer values, we know the vertical distance follows a nice pattern which includes π\sqrt{\pi}.

Figure 9. Continuous Factorial Function at x values between 4 and 5

Extra Help: An easier area example

We have considered two examples, the natural log function and the gamma function, where we used a different function, the area function, to return a value for the original function. This is likely a new concept for many of you, and it is a creative step that may seem difficult to fully understand. So, before we finish this section, here is a simpler example to consider if this is still a difficult concept to grasp.

Consider an example you are likely familiar with. Figure 10 is a graph of y=x2y = x^2 .

Figure 10. Graph of y=x2y=x^2

We know the result of this function if we input x=2x = 2. If we input 2, the output or the graph returns 4. Likewise, if we input x=3x = 3, the graph returns 9. We know this because we know that x2=x×xx^2 = x \times x. But we can also get to this same result by measuring an area. Specifically, we want to calculate the area of a square. If our input is 2, then the length of each side of the square is 2. If the input is the variable xx, then the length of each side of the square is also xx. Therefore, one way I can describe the formula for this graph is to draw a square with length xx. Then the value of the function is the area of a square. Figure 11 illustrates this concept for x=2x = 2. Therefore, we can identify the solution to the function y=x2y = x^2 for x=2x = 2 by calculating the area of the square with side 2. The area for the square is 2×2=42 \times 2 = 4, which is the same as y=x2y = x^2 for x=2x = 2.

Figure 11. Area of square with side 2

Even though this example may seem trivial, I think it is easy for us not to connect that the algebra statement y=x2y = x^2 is the same concept used in geometry for a square with length xx. In fact, take a moment and reflect on why we refer to an exponent of 2 as "squared." In other words, we usually refer to this expression x2x^2 as "xx-squared." This expression is the same thing as the area for a square with length xx. This geometric perspective is how Euclid and the Greeks thought of something being “squared.” Literally, it was a square. There was not an exponent of 2 because there was no algebra. 

The point is that if we want to calculate the solution to the equation y=x2y = x^2 for x=2x = 2, we could calculate the area for a square with a side equal to 2. We can make this comparison dynamic and change 2 to any value xx. In other words, y=x2y = x^2 represents the area of a square with length xx. As xx changes, the length of the side changes. Of course, this works for non-integer values, so the value of the graph at x=2.1x = 2.1 is the area of the square in Figure 12.

Figure 12. Area of square with length 2.1

Thus, one way to think about the value of the graph of y=x2y = x^2 is to draw a shape (in this case, a square) and calculate the area for that shape. This simple analogy is training our brain to travel between perspectives using algebra and geometry.

This is the same principle we used for the result of the natural log function and the Continuous Factorial Function.

Also, there is one more item I want to clarify. We have discussed the gamma constant and now the gamma function. There is also the gamma distribution, which we will not discuss in Lazarus Math. The gamma distribution does use the gamma function as part of its definition. Like the factorial function, the gamma function and gamma distribution are extremely important functions in applied and theoretical math. These functions do remarkable things in the world of math. Math is a never-ending opportunity for growth. Once you get comfortable with the gamma function, then there is another “hill to climb” for those interested in taking the gamma function to another level!

Technical details

For those interested, I’m providing a few technical details. First, here is the notation for connecting the gamma function to the Continuous Factorial Function.

Γ(x)=(x1)!\Gamma\left(x\right)=\left(x-1\right)!

Notice, we subtract 1 when we change from the gamma function notation to the factorial function. Then, we apply that change to the definition for the integral, or the area under the function.

Γ(z)=0xz1exdx\Gamma(z)=\int_{0}^{\infty}x^{z-1}\cdot e^{-x}dx

Now, for the bigger goal, let’s actually use the process of integration to calculate the area under this graph. This does get technical, but I will provide the details for those interested. One benefit for working through the details, in addition to being interesting, is you will understand how the factorial function results from this process.

Our goal is to eventually compute the definite integral:

0x5exdx\int_0^\infty x^5{e^{-x}} dx

when z=6z=6 in Γ(6)=5!\Gamma(6)=5!.

But we’re going to start easy with an exponent of 1 rather than 5. Also, we will ignore the bounds of the integral for now. Thus, our first goal is to integrate this:

\Gamma(2)=\int {x^1}e^{-x} dx \text{ }\tag{1}

We must integrate by parts. This is a common technique in calculus. The general form for integrating is to rewrite the expression into 2 functions, where f=xf=x and dg=exdxdg=e^{-x}dx. Then, we can write

\int f \text{ }dg=f \text{ }g-\int g \text{ } df \text{ }dx \text{ }\tag{2}

where f=x, dg=exdxf=x, \text{ } dg=e^{-x}dx

df=dx, g=exdf=dx, \text{ }g=-e^{-x}

Now, substitute for the right side of (2)

=-e^{-x}x+\int e^{-x}dx \text{ } \tag{3}

=-e^{-x}x-e^{-x} \tag{4}

=-e^{-x}(x+1)\tag{5}

Then, it is a small step to expand this to the exponent 2.

\int_0^∞ {x^2}e^{-x} dx \text{ }\tag{6}

The general equation (2) still applies, but we use a different definition for ff.

f=x2, dg=exdxf=x^2, \text{ } dg=e^{-x}dx

df=2x dx, g=exdf=2x \text{ }dx, \text{ }g=-e^{-x}

Then, equation (7) is slightly different from equation (3).

=-e^{-x}x^2+2\int e^{-x}x\text{ }dx \text{ } \tag{7}

Here’s where we see the magic because the integral in equation (7) is the same as the integral in equation (1). Thus, we can substitute the result, which is equation (5).

-e^{-x}x^2-2e^{-x}(x+1) \text{ } \tag{8}

=-e^{-x}(x^2+2x+2)\\=-e^{-x}(x+1)(x+2) \text{ } \tag{9}

Now, we can see the recursive formula. If we repeat for exponent 3, we get this result:

-e^{-x}(x^3+3x^2+6x+6)\\=-e^{-x}(x+1)(x+2)(x+3)\tag{10}

If the exponent is 4, we get this result:

-e^{-x}(x^4+4x^3+12x^2+24x+24)\\=-e^{-x}(x+1)(x+2)(x+3)(x+4)\tag{11}

Finally, if the exponent is 5, we get this result:

-e^{-x}(x^5+5x^4+20x^3+60x^2+120x+120) \\=-e^{-x}(x+1)(x+2)(x+3)(x+4)(x+5)\tag{12}

Now we have reached our destination. When the exponent is equal to 5, we can calculate the result by substituting the upper limit \infty and lower limit 0. The exponential that is factored out becomes 0, which makes the entire expression 0 even though we have infinity within parenthesis. Then, substitute the lower bound 0 and the exponential becomes 1 and all the terms within the parenthesis become 0 except the constant 120.

Since we subtract the lower bound, this produces a double negative, which is a positive 120. Thus, the result is 120. Notice 120=5!120=5!. Also, the result for using 4 as an exponent is 60=4!60=4! and so on. We can see the factorial at play when we write the results in a factored form. This is because we add the factor (x+n)(x+n) when the exponent changes from n1n-1 to nn.

You may have enjoyed this calculus gymnastics of integration or it may have seemed difficult. But one thing this process illustrates is how we produce an integer result for an integer input. This is because all the xx terms raised to a power are 0 when we substitute the lower bound 0. To me, the final result is not intuitive. However, as we work through the solution, this result does make sense.

Discover more in
:
Lazarus Math Part 2

  1. 40 min
    Harmonic Series
    Dave Kester Jun 6, 2022
  2. 60 min
    A log that is natural
    Dave Kester Jun 13, 2022
  3. 50 min
    Euler–Mascheroni constant
    Dave Kester Jun 20, 2022
  4. 50 min
    Gamma function
    Dave Kester Jun 27, 2022
  5. 25 min
    A closer look at the area function
    Dave Kester Jul 4, 2022
  6. 60 min
    Dancing with numbers
    Dave Kester Jul 11, 2022
  7. 40 min
    From 1/4 to 1/3
    Dave Kester Jul 18, 2022
  8. 50 min
    Geometric Sum
    Dave Kester Jul 25, 2022
  9. 60 min
    Madhava–Leibniz series
    Dave Kester Aug 1, 2022
  10. 45 min
    Connecting to something of interest
    Dave Kester Aug 8, 2022