Improper integrals, properly!

An improper integral is a type of definite integral where one (or both) of the limits approaches either -\infty, \infty or a real number. For example, \infty is not a number we can ‘plug-in’ so we must consider the value the integral as it approaches infinity.

One ‘improper’ limit

 \displaystyle  \int_1^{\infty} \frac{1}{x^2} \, dx = \lim_{k \to \infty} \int_1^k \frac{1}{x^2}  \, dx = \lim_{k \to \infty} \left[ -\frac{1}{x} \right]_1^k = \lim_{k \to \infty} \left(1 -\frac{1}{k} \right) = 1

This is a convergent integral. However, we would use the same process to demonstrate that an integral does not converge (or diverges to infinity).1

 \displaystyle  \int_1^{\infty} \frac{1}{\sqrt{x}} \, dx = \lim_{k \to \infty} \int_1^k \frac{1}{\sqrt{x}} \, dx = \lim_{k \to \infty} \left[ 2\sqrt{x} \right]_1^k = \lim_{k \to \infty} \left(2\sqrt{k} -2 \right) = \infty

We also use the same technique when a function tends towards a vertical asymptote. However, we have the added complication of not integrating or taking the limit over the asymptote.

 \displaystyle  \int_{0}^{1} \frac{1}{\sqrt{x}} \, dx

In this situation, we can’t evaluate the integrand at 0 so we take the limit which tends to zero from above (denoted with a superscript plus sign).

\displaystyle  \int_{0}^{1} \frac{1}{\sqrt{x}} \, dx = \lim_{c \to 0^{+}} \int_c^1 \frac{1}{\sqrt{x}} \, dx = \lim_{c \to 0^{+}} \left[ 2\sqrt{x} \right]_c^1 = \lim_{c \to 0^{+}}  \left(2-2\sqrt{c} \right) = 2

Equivalently, we would denote a limit that is tending to a value from below using a minus sign.

\displaystyle  \int_{-1}^{0} \frac{1}{\sqrt[3]{x^2}} \, dx = \lim_{c \to 0^{-}} \int_{-1}^c \frac{1}{\sqrt[3]{x^2}} \, dx = \lim_{c \to 0^{-}} \left[ 3\sqrt[3]{x} \right]_{-1}^c = \lim_{c \to 0^{-}}  \left(3\sqrt[3]{c}-3 \right) = -3

Two ‘improper’ limits

\displaystyle  \int_{-\infty}^{\infty} \frac{1}{1+x^2} \, dx

In this case, we would expect the integral to be the same as the sum of two (one-sided) improper integrals about any point within the domain. So, for example,

\displaystyle  \int_{-\infty}^{\infty} \frac{1}{1+x^2} \, dx = \int_{-\infty}^{0} \frac{1}{1+x^2}  \, dx +\int_{0}^{\infty} \frac{1}{1+x^2} \, dx

The two-sided improper integral can only converge and exist if both one-sided improper integrals converge and exist.

\displaystyle  \int_{-\infty}^{0} \frac{1}{1+x^2}  \, dx +\int_{0}^{\infty} \frac{1}{1+x^2} \, dx = \lim_{a \to -\infty} \int_{a}^0 \frac{1}{1+x^2} \, dx +\lim_{b \to \infty} \int_0^b \frac{1}{1+x^2} \, dx =

\displaystyle \lim_{a \to -\infty} \left[\arctan{x} \right]_a^0 +\lim_{b \to \infty} \left[\arctan{x} \right]_0^b = \lim_{a \to -\infty} \left[\arctan(0) - \arctan(a) \right] +\lim_{b \to \infty} \left[\arctan(b)-\arctan(0)\right]

\displaystyle = \left[0 - \left(-\frac{\pi}{2}\right) \right] +\left[\left(\frac{\pi}{2}\right)-0\right]= \frac{\pi}{2}

In a similar fashion, we may have to consider splitting an improper integral into more than two parts. For example,

 \displaystyle  \int_{-\infty}^{\infty} \frac{1}{x^2} \, dx = \int_{-\infty}^{-1} \frac{1}{x^2} \, dx + \int_{-1}^{0} \frac{1}{x^2} \, dx + \int_{0}^{1} \frac{1}{x^2} \, dx + \int_1^{\infty} \frac{1}{x^2}  \, dx

The example above would need splitting into four parts due to the plus/minus infinity at both limits as well as the asymptote at x=0. However, the overall integral will only converge if all the individual parts converge. The above example does not converge as neither the second nor third improper integrals converge (remember you only need to show one part does not converge).

A counter-intuitive result

It is hopefully well known that an even function is one that satisfies f(-x)=f(x). It can be useful to utilise the symmetrical property for this integral as, for an even function:

\displaystyle  \int_{-a}^{a} f(x)  \, dx = \int_{-a}^{0} f(x) \, dx +\int_{0}^{a} f(x)  \, dx = 2 \int_{0}^{a} f(x)  \, dx

By symmetry, either both of the summed integrals are finite or they are both infinite, so we can use this to evaluate an improper integral.

An odd function is one that satisfies g(-x)=-g(x). This means that

\displaystyle  \int_{-a}^{a} g(x) \, dx = \int_{-a}^{0} g(x) \, dx +\int_{0}^{a} g(x) \, dx = \int_{0}^{a} g(x) \, dx -\int_{a}^{0} g(x) \, dx =0

Or does it!? In fact, this is only true if a \in \mathbb{R} . It is not true of improper integrals (remember \infty - \infty \ne 0). This leads to a possibly counter-intuitive result that

\displaystyle  \int_{-\infty}^{\infty} x \, dx \ne 0

Footnote

    Some would say that if a limit is ‘equal’ to infinity then the limit does not exist because it can only equal a value.

Correlation and Causation

As Trump so eloquently states “Look at that chart; you don’t have to know what’s on it”.

It is well known that journalists, scientists, in fact anyone trying to prove their point may massage or manipulate figures to help them achieve their aim. In fact, a famous book was written by journalist Darrell Huff on How To Lie With Statistics.

When teaching the topic of correlation at A Level mathematics, it is tempting to trot out the phrase “Correlation does not imply causation”. In fact, this is a quoted content statement for learners from Ofqual’s A Level Mathematics conditions and requirements. However, understanding should go further than that.

Source: xkcd.com

Coincidental correlation or spurious correlations

There are some great examples of correlated quantities that have no obvious causal relationships. See http://www.tylervigen.com/spurious-correlations for more of the below. These are the main reason for the “correlation does not imply causation” argument.

r=0.99789 which is an extremely high correlation

However, in the real world, correlation may be evidence to look further and see if one of the following causal relationships is occurring. If we want to get technical it is a necessary but not a sufficient condition. More informally, it isn’t enough but might hint to something going on.

Explanations for correlation

When identifying correlation, whilst not jumping to claim causation, we should carefully consider the possible causation models we could be observing:

  • “Direct Causation” suggests that, if A is true, then B follows: A \Rightarrow B
  • “Reverse Causation” suggests that B causes A: A\Leftarrow B
  • “Third common factor” suggests that there is another underlying explanatory factor: \{ C \Rightarrow A \} \cap \{ C \Rightarrow B\} (see also Confounder)
  • Two factors cause another \{ A \Rightarrow C \} \cap \{ B \Rightarrow C\} (see also Berkson’s paradox)
  • “Cyclic Causation” where each factor causes the other: \{ A \Rightarrow B \} \cap \{ B \Rightarrow A\}
  • “Indirect Causation” A \Rightarrow C \Rightarrow B
  • Coincidence

Reverse causation

It is possible that one might observe that people who reduce their intake of saturated fats (factor A) correlates with people having problems with heart disease (factor B). This seems unlikely until one considers a possible reverse causation. People who find out they have a family history or are at risk of heart disease may try to take action to reduce their intake of saturated fats and thus it is factor B that is causing factor A.

A similar story may show that ex-smokers are more likely to die from lung disease than current smokers. Clearly it was not the giving up that was harmful; however, there may have been earlier problems related to lung disease that caused them to give up in the first place.

Third common factor

It is possible that correlation may be down to a confounding variable that causes both our correlated variables to happen. Some cases are clearer than others.

I could state that getting a top grade at Mathematics GCSE is correlated with obtaining a first-class degree at university. Clearly, one can do very badly at GCSE but do very well in a (probably unrelated) degree and it is certainly possible to do well at GCSE but badly at university. However, contributing to both these variables is some underlying intelligence which is required to do well in an academic pursuit.

Movies that are advertised at the during the Super Bowl advertisements tend to perform well at the box office. However, this is likely because it is likely to be big budget movies that can afford this premium advertising space.

Another example is that medical studies found a strong correlation between lung cancer and alcohol consumption. However, reports have since concluded that smoking was the confounding variable in this studies which was linked to both lung cancer and smoking. The direction of causality between alcohol and smoking is less clear here (see later examples of moderation and mediation).

Two factors cause another

It is not obvious why if two factors cause another then they should be correlated. However, if my sample is actually conditioning on a third factor then I may observe a correlation (or negative correlation) between the two factors.

Imagine I am trying to see if people with diabetes (factor A) are more at risk of having a heart attack (factor B). I want to measure the incidence of each disease in the general public and see if there is a correlation. However, if I sample from a hospital waiting room then, because the respondents needed to attend hospital for something (factor C), a hospital patient without diabetes is much more likely to be at risk of a heart attack than a member of the general public without diabetes. This is because there must have been some non-diabetes (and possibly heart attack) related reason for them to attend hospital in the first place and there would be a negative correlation between A and B. This is an example of Berkson’s paradox.

A dating example would be that if you could quantify the traits of kindness and attractiveness in a person, then one might observe a negative correlation between these traits in the people I dated. This is not because there is necessarily a general correlation between these traits but because, presumably, they are more likely to have had at least one of these traits for me to date them (and a higher quantity of one may have been seen to mitigate a lower quality of the other).

Cyclic causality

Sometimes also referred to as simultaneity, a cyclic causation means that both factors may be affecting each other. For example, with alcohol and depression. People who are depressed may be more likely to drink alcohol. However, alcohol is also a depressant drug so may cause depression.

Another example is a system of predators and prey. An absence of predators may allow a species of prey to grow rapidly. Plenty of prey for predators may mean that species can grow rapidly. However, if the numbers of prey then start to reduce, there is not enough food for predators which has a negative effect on their population numbers.

Indirect Causation

It may be that we are missing a possibility explanatory variable between the correlated variables. One might observe that age and job satisfaction are positively correlated. However, perhaps there is an indirect causation that age leads to experience and higher pay which leads to better job satisfaction.

Sometimes, one may also further discuss these other types of interlinked causation. When factor C may be a moderator where a lack of this factor mean that A \nRightarrow B but the presence of the moderator C directly acts upon the causation A \Rightarrow B . For example, there may be a weak correlation and causal relationship between depression (factor A) and physical health (factor B). However, in the presence of poverty (factor C) this moderates the relationship so there is now a high correlation between the depression and physical health.

Another example may be that person’s IQ may be a moderating variable (factor C) between the hours of time spent revising (factor A) and their mark in an examination (factor B)

This should not be confused with a mediation (factor C) that acts in addition to the causality so \{ A \Rightarrow B \} \cap \{ A \Rightarrow C \Rightarrow B \}. For example, if again factor A is the time spend revising and factor B is their mark in an examination so A \Rightarrow B but the mediating factor C is the number of practice problems completed which can only be completed with more revision time and may have a more direct affect on performance (A \Rightarrow C \Rightarrow B).

Post hoc ergo propter hoc

One should consider the causality pathways so that we do not jump to incorrect conclusions. A common logical fallacy is “post hoc ergo propter hoc” (after this, therefore because of this). It is the false conclusion that A happened, then B happened therefore A \Rightarrow B. One of my favourite TV shows, The West Wing, humorously explains this in an episode of the same name.

The West Wing, Season 1, Episode 2: President Bartlet explains the logical fallacy “post hoc ergo propter hoc”.

History of Calculus: Newton v Leibniz

I was listening to a podcast about the bitter rivalry between Isaac Newton and Gottfried Leibniz the other day. Although I’ve introduced calculus for the first time to a number of students over the years, I’ve never really though to consider the historical significance and controversies of this innovation.

In fact, what we teach as calculus today was not fully understood for many years. Although, now they seem related, Newton and Leibniz were trying to address different problems (and functions were not in use at the time)

Teachers and students are very familiar with questions of the form, if the equation of a curve is y=x^3-2x+1 find the gradient at the point (2,1). Although not in this form, the problem of finding an exact gradient (or drawing an exact tangent) to a curve at a particular point was a famous mathematics problem of the time and something the Ancient Greeks had been interested in. Newton claims to have first found a method for finding the exact gradient.

Newton claims he first invented his ideas about differential calculus in 1666 through fluxions and fluents which were not considered the same as Leibniz’s work. A “fluent” was a quantity that was varying with time (we now consider this a function of time), for example the displacement of a body in motion is a fluent. Newton’s work on differential calculus was concerned with finding the “fluxion” of a fluent. This was the rate of change of the fluent at a particular point. For example, the fluxion of a displacement fluent gives the velocity. Newton’s dot notation is still in use today \dot{x}=\tfrac{dx}{dt} and \ddot{x}=\tfrac{d^2x}{dt^2} (as well as lesser used notation, \dot{\ddot{x}} anybody?)

Leibniz was the first to publish work about calculus in 1684. He was considering the range of variables x and y infinitely close to each other. His work on infinitesimals and much of his notation is familiar to use today. Leibniz recognised the need for an operator and, in his work on integration, introduced the elongated ‘S’ (summation) as well as writing notation for infinitesimals such as ‘dx’.

Leibniz called his work on integrals “calculus summatorius“. He first used the elongated ‘S’ (summation) for integration on 29 October 1675. As you can see, much of his work and notation is recognisable to that we use today.

Photo from Stephen Wolfram’s blog

The use of infinitesimals caused problems and many at the time were not happy with their usage. Newton would have argued along the lines of

(x+o)^n=x^n + nox^{n-1}+\frac{n(n-1)}{2}o^2 x^{n-2}+...

Then, when comparing the change from x^n to (x+o)^n let higher terms of o vanish.

Whilst recognising this work led to correct results, Bishop George Berkley was unimpressed by the lack of rigour in using infinitesimals.

“They are neither finite quantities, nor quantities infinitely small, nor yet nothing. May we not call them ghosts of departed quantities?”

George Berkley (1734) in Section XXXV of “The analyst: A discourse addressed to an infidel mathematician”

It would be another 100 years before the works of Cauchy, Weierstrauss and Riemann would formally overcome these concerns by redefining calculus in terms of limits.

Theory behind calculus (Pt. II)

In my previous post I extolled the virtue of adding more of the underlying theory of calculus to the reformed Maths A Level Subject Requirements:

  • “Understand and use (…) differentiation from first principles”
  • “Understand and use integration as the limit of a sum” and to “estimating the approximate area under a curve and limits that it must lie between”

Last time I looked at differentiation from first principles. Now comes the turn of integration.

Riemann integrals and Riemann sums

Previously part of Further Maths A Level for some boards, all A Level Maths students must now have a loose understanding of Riemann sums through approximation via rectangles.

Screenshot of dynamic Geogebra applet to illustrate Riemann sums (click image)

If, like the example above, the function is always increasing (or always decreasing) then you can easily construct rectangles of equal width that will give you a lower bound for the area. Similarly, you can take rectangles of equal width and a different height to give you an upper bound for the area.1

For any increasing function, the limits using rectangles can be taken as:

\displaystyle \int_a^b f(x) \, dx > h \times \left[f(a)+f(a+h)+f(a+2h)+...+f(b-2h)+f(b-h)\right] and

\displaystyle \int_a^b f(x) \, dx < h \times \left[f(a+h)+f(a+2h)+...+f(b-h)+f(b)\right]

The Riemann integral can then be defined as the limit, L because both h \times \left[f(a)+f(a+h)+f(a+2h)+...+f(b-2h)+f(b-h)\right]\to L and h \times \left[f(a+h)+f(a+2h)+...+f(b-h)+f(b)\right] \to L as h\to 0

Sometimes it is easy to evaluate these limits as polynomials in h. For n rectangles of equal width, the below example gives us the definite integral of y=x^2 from 0 to 1.

\displaystyle \frac{1}{n}\left[0^2+\left(\frac{1}{n}\right)^2+\left(\frac{2}{n}\right)^2+...+\left(\frac{n-2}{n}\right)^2+\left(\frac{n-1}{n}\right)^2\right]<\int_0^1 x^2 dx<\frac{1}{n}\left[\left(\frac{1}{n}\right)^2+\left(\frac{2}{n}\right)^2+...+\left(\frac{n-1}{n}\right)^2+1^2\right]

\displaystyle \frac{1}{n}\sum_{r=0}^{n-1} \left(\frac{r}{n}\right)^2<\int_0^1 x^2 dx<\frac{1}{n}\sum_{r=1}^{n} \left(\frac{r}{n}\right)^2

\displaystyle \frac{1}{n^3}\frac{1}{6}n(n-1)(2n-1)<\int_0^1 x^2 dx<\frac{1}{n^3}\frac{1}{6}n(n+1)(2n+1)

\displaystyle \frac{1}{6}\left(1-\frac{1}{n}\right)\left(2-\frac{1}{n}\right)<\int_0^1 x^2 dx<\frac{1}{6}\left(1+\frac{1}{n}\right)\left(2+\frac{1}{n}\right)

so \displaystyle \int_0^1 x^2 dx \to \frac{1}{3} as \displaystyle n \to \infty

On could do similar things with other polynomials; however, to obtain an exact answer one must know how to evaluate the \displaystyle \sum_{r=1}^{n} r^k in order to take a limit. This also may not work for other functions that can be integrated analytically which do not have a limit for \displaystyle \sum_{r=1}^{n} f(r). For other integrals, we may only get a numerical limit.

Fermat’s method of integration

Pierre de Fermat used a different infinite series of rectangles whose widths were in a geometric progression to compute the summation or ‘integral’ of y=x^k exactly for any k\in {\mathbb Q}^{+}.

Screenshot of Geogebra applet to illustrate Fermat’s method of integration sums (click image)

Fermat was the first to consider the area underneath a curve as an infinite series. Archimedes had found the area inside a parabola geometrically in the 3rd Century BC. Bonaventura Cavalieri made strides towards modern integral calculus in the mid 17th Century with his quadrature formula evaluating \int x^k \, dx for k=1,2,\dots,9. Evangelista Torricelli extended this work and then Sir John Wallis used mathematical induction in his work on series and rational powers to find \int x^k \, dx for k\in {\mathbb Q}^{+}. Fermat later did this using an infinite series. However, it was Newton and Leibniz who then related integration to differentiation which started the field of calculus.

Footnote

    1. If a function changes between increasing and decreasing then we just need to make sure we change the rectangles so that one set are all below the curve and form a lower bound and the others, all above the curve, form an upper bound. Within each interval width these values are usually described as ‘inf’ (infimum) and ‘sup’ (supremum).

Theory behind calculus (Pt. I)

As a mathematics teacher, there are some changes to the specification and other elements of the A Level reform for first examination 2019, that I have been rather unhappy with. However, one change that I fully support is the introduction to A Level mathematics is differentiation from first principles and relating integration to the limit of infinitesimally small rectangles and Riemann sums.

Ofqual’s GCE Subject Level Conditions and Requirements for Mathematics now require all examination boards to include the content:

  • “Understand and use (…) differentiation from first principles”
  • “Understand and use integration as the limit of a sum” and to “estimating the approximate area under a curve and limits that it must lie between”

Without this, there is always a danger that students will see calculus as a set of rules to follow rather than a concept from which rules have been derived. This difference in approach means students are much better placed to consider and encounter improper integrals and the like.

Differentiation from First Principles

Students should understand differentiation as the limit of a chord towards a tangent. This is normally well covered in secondary schools. However, pupils should also understand more than one set of notation for how this can be expressed:

At a particular point x=a, this may usefully be defined as:

\displaystyle f'(a)=\lim\limits_{x\rightarrow a}\frac{f(x)-f(a)}{x-a}

However, this is often written as the following. I think pupils should understand the idea of \frac{\Delta y}{\Delta x} as it is likely to be how they have met the idea of a gradient of a straight line in Key Stage 3. Using \delta x to be a small increment from x then links to Leibniz’s differentiation notation dx. Textbooks and other sources often use h as it is more concise than writing \delta x.

\displaystyle f'(x)=\frac{d}{dx}f(x)=\lim\limits_{\Delta x\rightarrow 0}\frac{\Delta y}{\Delta x} = \lim\limits_{\delta x\rightarrow 0}\frac{f(x + \delta x)-f(x)}{\delta x}=\lim\limits_{h\rightarrow 0}\frac{f(x + h)-f(x)}{h}

The A Level examinations require differentiation from first principles only for small positive integers n for x^n; however, I’d encourage better pupils to try and extend the concept to \frac{1}{x} and \sqrt{x} as they are accessible and give an indication that this definition is not constrained to just positive integers.

\frac{d}{dx}{\left[\frac{1}{x}\right]}=\lim\limits_{h\rightarrow 0}\frac{\frac{1}{x+h} -\frac{1}{x}}{h}=\lim\limits_{h\rightarrow 0}\frac{\frac{x-(x+h)}{x(x+h)}}{h}=\lim\limits_{h\rightarrow 0}\frac{\frac{-h}{x(x+h)}}{h}=\lim\limits_{h\rightarrow 0}\frac{-1}{x^2+xh}=-\frac{1}{x^2}

\frac{d}{dx}{\left[\sqrt{x}\right]}=\lim\limits_{h\rightarrow 0}\frac{\sqrt{x+h} -\sqrt{x}}{h}\times\frac{\sqrt{x+h} +\sqrt{x}}{\sqrt{x+h} +\sqrt{x}}=\lim\limits_{h\rightarrow 0}\frac{(x+h) -(x)}{h(\sqrt{x+h} +\sqrt{x})}=\lim\limits_{h\rightarrow 0}\frac{1}{\sqrt{x+h} +\sqrt{x}}=\frac{1}{2\sqrt{x}}

The more students can be comfortable with differentiation from first principles initially, the better equipped they will be to understand the chain rule, differentiation of trigonometric functions and other calculus results later on in A Level.

Fluency vs Understanding

Over the past eight years, I’ve taught more and more mathematics to A Level and Further Mathematics A Level students. I’ve been increasingly keen on ‘filling’ in the gaps from textbooks that explain why a theory works or where a method comes from. This has, at times, led me to teach much higher level material than the course to students so they may fully understand the specification content. At least that is what I thought. Am I just teaching it for my own understanding and should I always be teaching the understanding and proofs?

I advocate proving results when they are reasonable but also need to ensure I am not doing it ‘for the sake of it’ which may actually confuse learners. The following is a good example about teaching fluency versus teaching understanding. Sometimes it is most sensible to do the former or ‘handwave’ slightly.

Suppose you want to teach multiplication of negative numbers. The rule “If they have the same sign then the answer is positive, and if they have different signs then the answer is negative” is a short and straightforward rule, but explaining why -2 times -3 should equal 6 is not very straightforward. So if one begins with the explanation, there is a big risk of conveying the idea that multiplication of negative numbers is a difficult, complicated topic, whereas if one gives plenty of practice in applying the simple rules, then one gives one’s students fluency in an operation that comes up in many other contexts (…) and one can try to justify the rule later, when they are comfortable with the rule itself.

https://gowers.wordpress.com/2018/12/22/how-craig-barton-wishes-hed-taught-maths/