Extra credit question

This is worth 5 points extra credit if done properly and turned in by May 4.

Get this as an ipynb file for IJulia.

Let $f$ be a function defined on the real line. M. Stemlund proved in 2001 (The College Mathematics Journal, 32, 194-196) the following:

The function $f(x)$ is a quadratic polynomial if and only if for any $a$ and $b$ the intersection point of the tangents lines to $f(x)$ at $(a, f(a))$ and $(b, f(b))$ happens at $x=(a+b)/2$.

We wish to investigate this. Here are some tools for our toolbelt:

using Plots
using Roots
Base.ctranspose(f::Function) = D(f)
tangent(f, c) = x -> f(c) + f'(c)*(x-c)
tangent (generic function with 1 method)

We can graph two tangent lines using this pattern:

f(x) = exp(x)
a,b = 1, 2
plot(f, 1, 2)
plot!(tangent(f, a))
plot!(tangent(f, b))
-0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 0 1 2 3 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 y1 y2 y3 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 16 18 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 -10 0 10 20 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0

Here we can see the intersection point is not at (a+b)/2 = 1.5, but a bit to the right of that.