Derivation of Generalization of the Gamma Function

The following definite integral problem was posted on stackexchange today.

(1)   \begin{equation*} 1.35 \times {10^{ - 7}}\int {{e^{ - 0.03x}}{x^4}dx} \end{equation*}

 

The version of the gamma function, a useful function for solving improper integrals, that I learned as an undergraduate physics major is

(2)   \begin{equation*}\int_0^\infty {{e^{ - x}}{x^n}dx = n!} \end{equation*}

At first glance, it appears that the gamma function (equation (2)) can be used to solve equation (1), since a constant times a definite integral is equal to the constant times the definite integral. However, since -0.03x \neq x, equation (2) can’t be used to solve equation (1); the integrands are not of the same form. But it is possible to derive a formula for solving improper integrals of the same form as equation (2) using u-substitution and the gamma function.

Equation (1) has the form

(3)   \begin{equation*} c \int_0^\infty {{e^{ - ax}}{x^n}dx} \end{equation*}

(with c and a being constants being any constant).

Let

(4)   \begin{equation*} u = ax \end{equation*}

It follows from equation (4) that

(5)   \begin{equation*} x = \frac{u}{a} \end{equation*}

and

(6)   \begin{equation*} dx = \frac{du}{a} \end{equation*}

Applying equations (4), (5), and (6) to equation (3):

(7)   \begin{equation*}c\int_0^\infty {{e^{ - ax}}{x^n}dx} = c\int_0^\infty {{e^{ - u}}{{\left( {\frac{u}{a}} \right)}^n}\frac{{du}}{a}} \end{equation*}

(8)   \begin{equation*} c\int_0^\infty {{e^{ - ax}}{x^n}dx} = \frac{c}{{{a^{n + 1}}}}\int_0^\infty {{e^{ - u}}{u^n}du}\end{equation*}

In equation (7), \int_0^\infty {{e^{ - u}}{u^n}du} is just the gamma function, and is thus equal to n!.

Note: the bounds of integration have not changed, since when x goes to zero, from equation (4), u goes to zero as well. And when x goes to infinity, u goes to infinity for any non-zero constant a.

Finally, from equations(7) and (2) (the gamma function):

(9)   \begin{equation*} \boxed{c\int_0^\infty {{e^{ - ax}}{x^n}dx} = \frac{c}{{{a^{n + 1}}}}n!}\end{equation*}

From (1), c = 1.35 \times 10^{-7} and a = 0.03. So the solution to (1) is:

    \[\boxed{1.35 \times {10^{ - 7}}\int_0^\infty {{e^{ - 0.03x}}{x^n}dx} = \frac{{1.35 \times {{10}^{ - 7}}}}{{{{0.03}^5}}}4! = \frac{{400}}{3}}\]

Without using equation (8), the integral could still be solved, but it would require using integration by parts multiple times (unless there is another method that I am unaware of), which is an unnecessarily long and arduous way to evaluate the integral.

 

Using Python To Find Square-Triangular Numbers

A number is triangular if it satisfies the formula \frac{n(n+1)}{2} for some positive integer n. The square-triangular numbers are numbers that are both triangular and the square of a positive integer.

Letting the n-th triangular number equal

\frac{{n\left( {n + 1} \right)}}{2}

…and the square of the m-th positive integer equal m^2… it follows that a positive integer is both triangular and a square if

\frac{{n\left( {n + 1} \right)}}{2} = m^2

for some value of n and some value of m. Finding pairs of values of m and n that satisfy this equation is not easy by hand. The following manipulations of the equations above allow for the use of a simple python algorithm to find square-triangular numbers.

\frac{1}{2}n\left( {n + 1} \right) = {m^2}

\frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} = \frac{1}{2}\left( {{n^2} + n + \frac{1}{4}} \right) = \frac{1}{2}\left( {{n^2} + n} \right) + \frac{1}{8}

\frac{1}{2}n\left( {n + 1} \right) = \frac{1}{2}\left( {{n^2} + n} \right) = \frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} - \frac{1}{8} = {m^2}

\frac{1}{2}{\left( {n + \frac{1}{2}} \right)^2} - {m^2} = \frac{1}{8}

4{\left( {n + \frac{1}{2}} \right)^2} - 8{m^2} = 1

2 \cdot \left( {n + \frac{1}{2}} \right) \cdot 2\left( {n + \frac{1}{2}} \right) - 8{m^2} = 1

{\left( {2n + 1} \right)^2} - 8{m^2} = 1

{\left( {2n + 1} \right)^2} - 2 \cdot {\left( {2m} \right)^2} = 1

{\left( {2n + 1} \right)^2} - 2 \cdot {\left( {2m} \right)^2} - 1 = 0

The following two definitions will help simplify the equation above:

w \equiv 2n + 1

z \equiv 2m

With the definitions of w and z above, {\left( {2n + 1} \right)^2} - 2 \cdot {\left( {2m} \right)^2} = 1 can be re-written as

{w^2} - 2{z^2} - 1 = 0

Finding values of w and z that satisfy the equation above is not simple, but solutions can be found easily in Python. The following short algorithm finds the first 6 square-triangular numbers.

Informal Proof of the Associative Law of Matrix Multiplication

In general, if A is an m \times n matrix (meaning it has m rows and n columns), the matrix product AB will exist if and only if the matrix B has n rows. If B is an n \times p matrix, AB will be an m \times p matrix. In general, if A is an m \times n matrix (meaning it has m rows and n columns), the matrix product AB will exist if and only if the matrix B has n rows. If B is an n \times p matrix, AB will be an m \times p matrix.

When multiplying one matrix by another, the number of columns of the matrix on the left must be equal to the number of rows of the matrix on the right. The number of rows of the resulting matrix will be equal to the number of rows of the matrix on the left, and the number of columns will be equal to the number of columns of the matrix on the right.

For (AB)C to exist, C must have p rows (the same number of rows as columns of AB). If C is a p \times r matrix, (AB)C will be an m \times r matrix.

If (AB)C exists, A(BC) will also exist and have the same shape as (AB)C. For these matrices to exist, A must have the same number of columns as B has rows, and C must have the same number of rows as B has columns. If B is an n \times p matrix, for BC to exist, C must have p rows. If C is a p \times r matrix, BC will be an n \times r matrix. If (AB)C exists, that means that AB exists. If BC is an n \times r matrix, then A must have n columns. If A is an m \times n matrix, A(BC) will be an m \times r matrix. So if A is an m \times n matrix, B is an n \times p matrix, and C is a p \times r matrix, it follows that (AB)C and A(BC) both exist and are m \times r matrices.

When (AB)C and A(BC) both exist, (AB)C = A(BC). To prove this, all we must do is prove that an arbitrary column of AB(C) will be equal to the same arbitrary column in A(BC).

If K_i represents the i-th column of any matrix K, n \times p matrix B can be represented as

B = \left[ {\begin{array}{*{20}{c}} {{B_i}}& \cdots &{{B_p}} \end{array}} \right]

B_i is the i-th column of B, and is a vector with n rows. The i-th column of AB is equal to A times the i-th column of B.

AB = \left[ {\begin{array}{*{20}{c}} {\underbrace {A{B_1}}_{{{\left( {AB} \right)}_1}}}& \cdots &{\underbrace {A{B_r}}_{{{\left( {AB} \right)}_r}}} \end{array}} \right]

The j-th column of the matrix C can be represented as

\left[ {\begin{array}{*{20}{c}} {{c_{1j}}} \\ \vdots \\ {{c_{pj}}} \end{array}} \right]

c_{ij} is the value in row i, column j of C.

Column j of (AB)C is equal to AB times column j of C. This is equal to the linear combination of the i-th columns of (AB) with the i-th values in C_j.

{\left( {\left( {AB} \right)C} \right)_j} = \left( {AB} \right){C_j} = \left[ {\begin{array}{*{20}{c}} {A{B_1}}& \cdots &{A{B_p}} \end{array}} \right]

The j-th column of BC is equal to BC_j, which is equal to the linear combination of the i-th columns of B with the i-th values in C_j:

{\left( {BC} \right)_j} = B{C_j} = {c_{1j}}{B_1} + {\kern 1pt} \cdots + {c_{pj}}{B_p}

The j-th column of A(BC) is equal to the jth column of BC, (BC)_j times A.

{\left( {A\left( {BC} \right)} \right)_j} = A{\left( {BC} \right)_j} = A\left( {{c_{1j}}{B_1} + \cdots + {c_{pj}}{B_p}} \right) = {c_1}A{B_1} + \cdots + {c_{pj}}{B_p} = {\left( {\left( {AB} \right)C} \right)_j}

Since the j-th column of (AB)C is equal to the j-th column of A(BC), it follows that (AB)C = A(BC).