# Recovering a quadratic polynomial from three values using calculus

I'm asked to solve this using calculus:

Let $$f(x) = ax^2 + bx +c .$$ If $f(1) = 3$, $f(2) = 7$, $f(3) = 13$, then find $a$, $b$, and $f(0)$.

I know I can solve this using solving three equations simultaneously. And I can also solve this using Gauss Jordan or Gaussian elimination method by writing the augmented matrix. But I'm wondering is there any other method to solve this.

Solving by any method it turns out that $a = b = c = 1$.

• $a=b=c=1$ does not give $f(1)=2$. Mar 8, 2016 at 12:17
• @GerryMyerson oh sorry I typed it wrong. Corrected it now. Mar 8, 2016 at 12:21
• Look up "method of finite differences". Or look up Lagrange interpolation. Mar 8, 2016 at 12:24
• Like Simpson's trapezoid rule there is one for parabolic variations also. Mar 8, 2016 at 12:28
• @GerryMyerson unable to get any clue from there. Kindly try to give me first step as hint so that I can proceed further. Mar 8, 2016 at 12:31

This problem has nothing to do with calculus. Knowing about the symmetries of the quadratic function one can proceed as follows:

Make $(2,7)$ your origin. This amounts to introducing the function $$g(y):=f(2+y)-7\ .$$ Then $$g(y)=a'y^2+b'y+c', \qquad g(-1)=-4,\quad g(0)=0,\quad g(1)=6\ ,$$ and therefore $$c'=0,\qquad 2a'=g(1)+g(-1)=2,\qquad 2b'=g(1)-g(-1)=10\ .$$ It follows that $g(y)=y^2+5y$, so that $$f(x)=g(x-2)+7=(x-2)^2+5(x-2)+7=x^2+x+1\ .$$

• This seems like a great approach to me. And apart from the question I want to know one thing why hasn't anyone upvoted this question? Is something wrong with this question? I don't have reps to upvote. I'm new to this website. Mar 8, 2016 at 13:03
• @user109256 If there were something wrong with it, people would probably downvote, and maybe comment to let you know what they think is wrong. If you just haven't gotten upvotes, it probably means that not many people have seen the question, and those who have seen it didn't think it was especially useful. That's quite common. (Of course, now you do have some upvotes.) Mar 8, 2016 at 14:31

Hint

We can use the following convenient geometric fact about the graphs of polynomials of degree $\leq 2$:

Lemma The slope $m$ of the secant line between points $(x_1, y_1)$ and $(x_2, y_2)$ on the graph of a polynomial function $f(x) := a x^2 + b x + c$ of degree $\leq 2$ is the slope of the tangent line to the graph of $f$ at the midpoint of the interval $[x_1, x_2]$, that is, $m = f'\left(\frac{x_1 + x_2}{2}\right)$.

Proof By definition, $$m := \frac{f(x_2) - f(x_1)}{x_2 - x_1} = \frac{(a x_2^2 + b x_2 + c) - (a x_1^2 + b x_1 + c)}{x_2 - x_1} = a (x_1 + x_2) + b,$$ but we can write this as $$2a\left(\frac{x_1 + x_2}{2}\right) + b = f'\left(\frac{x_1 + x_2}{2}\right) .$$ QED.

This lemma immediately gives $$f'\left(\tfrac{3}{2}\right) = f(2) - f(1), \qquad f'(2) = \frac{f(3) - f(1)}{2}, \qquad f'\left(\tfrac{5}{2}\right) = f(3) - f(2) .$$ Now, $f'$ is itself linear, so it satisfies the same property, and hence we can recover the second derivative of $f$ at a convenient point.

Computing gives $$f''(2) = f'\left(\tfrac{5}{2}\right) - f'\left(\tfrac{3}{2}\right) = [f(3) - f(2)] - [f(2) - f(1)] = f(3) - 2 f(2) + f(1) .$$ We now have $f(2), f'(2), f''(2)$, which lets us recover $f(x)$ from its Taylor polynomial at $x = 2$: $$f(2) + f'(2) (x - 2) + \tfrac{1}{2} f''(2) (x - 2)^2 .$$ Substituting and simplifying gives $f(x) = x^2 + x + 1$.

• This uses calculus really.. Mar 8, 2016 at 13:01
• Yes, this seems like a sensible approach if you absolutely must use calculus Mar 8, 2016 at 13:21

Use calculus to solve this... Well, I can wedge some calculus in here...

The derivative of $f(x) = a x^2 + b x + c$ with respect to $x$ is $2ax+b$. By the Fundamental Theorem of Calculus, we have that \begin{align*} f(x) &= f(0) + \int_0^x 2 a t + b \,\mathrm{d}t \\ &= f(0) + (a t^2 + bt)_{t=x} - (a t^2 + bt)_{t=0} \\ &= f(0) + a x^2 + bx \text{.} \end{align*} (This is not a shocking revelation: $c = f(0)$.) Consequently, \begin{align*} f(1) = 3 &= f(0) + \int_0^1 2 a t + b \,\mathrm{d}t = f(0) + a + b \text{,} \\ f(2) = 7 &= f(0) + \int_0^2 2 a t + b \,\mathrm{d}t = f(0) + 4a + 2b \text{, and} \\ f(3) = 13 &= f(0) + \int_0^3 2 a t + b \,\mathrm{d}t = f(0) + 9a + 3b \text{.} \end{align*} This has the convenient property that it exactly contains the expressions, $a$, $b$, and $f(0)$, that are sought in the Question. Now we look at how the function changes between the given points. \begin{align*} f(2) - f(1) = 4 &= \int_1^2 2 a t + b \,\mathrm{d}t = 3a+b \text{ and} \\ f(3) - f(2) = 6 &= \int_2^3 2 a t + b \,\mathrm{d}t = 5a + b\text{.} \end{align*} These tell us $2a=2$, or $a=1$. Then the first tells us that $b=1$. From $3 = f(1) = f(0) + a + b$, we find $f(0) = 1$.

• This is clearly the "correct" solution the teacher was probably looking for. Well done Mar 8, 2016 at 21:12

Rather than solving a system of 3 equations (which is long and tedious) we will use the method of Lagrange Interpolation. The idea here is $n$ points on a polynomial uniquely identify a polynomial of degree $(n-1)$.

$$g(x) = \frac{(x-2)(x-3)}{(1-2)(1-3)}f(1) +\frac{(x-1)(x-3)}{(2-1)(2-3)}f(2)+\frac{(x-1)(x-2)}{(3-1)(3-2)}f(3)$$

We see that this function agrees with $f$ at $x = 1,2,3$ so we must have that $g = f$ (otherwise we have found two different polynomials that pass through the same 3 data points which we know cannot be true)

Multiply this out to reveal the values you desire!

• Possibly Lagrange Mar 8, 2016 at 17:52
• @LaurentDuval thanks a lot :) Mar 8, 2016 at 19:04

If you don't know Lagrange interpolation, then observe that $f(x)-4x+1$ has roots at $x=1$ and $x=2$. Then we get $$f(x)=a(x-1)(x-2)+4x-1$$ and can find $a$ by substituting $x=3$.

• I didn't understand what you are trying to say. Mar 8, 2016 at 12:58
• Let $g(x)=f(x)-4x+1$, then $g(1)=f(1)-3=0$ and $g(2)=f(2)-7=0$. $g(x)=0$ is also a quadratic equation like $f(x)=0$. Thus we can conclude that $g(x)=a(x-1)(x-2)$. Mar 8, 2016 at 13:02

A solution that deliberately doesn't use any calculus...

Given: \begin{align} f(1) \colon\quad \phantom{4}a+\phantom{2}b+c &= 3 \tag{1}\\ f(2) \colon\quad 4a+2b+c&=7 \tag{2}\\ f(3) \colon\quad 9a+3b+c&=13 \tag{3} \end{align} Subtract $(1)$ from $(2)$ and $(3)$, respectively: \begin{align} 3a+\phantom{2}b &= 4 \tag{A}\\ 8a+2b &= 10 \tag{B} \end{align} Subtract $2(A)$ from $(B)$: $2a=2$, or $a=1$.

Plug $a$ into $(A)$: $b=4-3a=4-3=1$.

Plug $a$ and $b$ into $(1)$: $c=3-a-b=3-1-1= 1$.

Hence, $f(x)=x^2+x+1$ and $f(0)=1$.

• I solved it this way only but I was wondering about any calculus method for solving this. Mar 8, 2016 at 17:40

One way is to consider the forward differences of the function. This is probably the fastest way if you are given consecutive values of a polynomial. In particular, define the forwards difference as follows: $$\Delta f(x) = f(x+1)-f(x).$$ Note that if we know $f(x)=ax^2+bx+c$ then one can find: $$\Delta f(x) = (2x+1)a + b$$ and we know from givens that $\Delta f(1)=4$ and $\Delta f(2)= 6$. Then, consider the second forwards difference: $$\Delta^2 f(x) = \Delta f(x+1) - \Delta f(x)$$ which, given $f(x)=ax^2+bx+c$ can be found as $$\Delta^2 f(x) = 2a$$ and we get $\Delta^2 f(1)=2$ from the givens. Thus $2a = 2$ so $a=1$.

Then we just work backwards: $$b = \Delta f(1) - 3a = 4 - 3 = 1.$$ Lastly, $$c=f(1) - b - a = 3 - 1 - 1 = 1.$$ Basically, the general idea is that, if we have a polynomial of degree $n$ with leading coefficient $a$, then $\Delta^n f(x) = n!\cdot a$ - that is, you take $n$ forwards differences, and get a constant function. Supposing you know the value of $\Delta^n f$ anywhere, this tells you the leading coefficient. Then, you subtract $ax^n$ from the polynomial, which leaves you with a polynomial of degree $n-1$ or less - so you just repeat the process on that, and read off the leading term.

This isn't quite calculus, but the basic idea is the same; we've just replaced the derivative with the forwards difference. We can build a system known as "discrete calculus" where everything regards this operator, and this gives a lot of the same results as usual calculus. One can also find calculus based proofs of the identities that come out of the process here - for instance, we can find that the $n^{th}$ forwards difference of a polynomial of degree $n$ has to be $n!\cdot a$ since it can be expressed as a weighted average of the values of the $n^{th}$ derivative near a point, but that's just a constant $n!\cdot a$.

A quadratic polynomial interpolation works quite well for a parabola. From Newton divided difference formula, you can write the following, with terms that cancel iteratively. Do no be afraid by the fractions, the technique is quite mechanical, and very practical for mental arithmetic extrapolation. Being of degree $2$, your function could be rewritten as:

$$f(x) = d_1 + d_2(x-x_1)+d_3(x-x_1)(x-x_2)$$ Now, find the $d_i$:

• set $x=x_1=1$, you get $$d_1=f(1)=3$$
• set $x=x_2=2$, you get $$d_2=\frac{f(x_2)-f(x_1)}{x_2-x_1} = \frac{7-3}{1} = 4$$
• set $x=x_3=3$, you get $$d_3=\frac{\frac{f(x_3)-f(x_2)}{x_3-x_2} -\frac{f(x_2)-f(x_1)}{x_2-x_1}}{x_3-x_1} = \frac{6-4}{2} = 1$$

Hence: $$f(x) = 3+4(x-1)+1(x-1)(x-2)$$ thus $f(0)=1$.

• @Gerry Myerson I hereby acknowledge your comment on "method of finite differences" that I did not see initially Mar 9, 2016 at 15:38

This caught my eye: $$\begin{eqnarray} f(1)=&3&=2\cdot1+1 \\ f(2)=&7&=3\cdot2+1 \\ f(3)=&13&=4\cdot3+1 \\ \end{eqnarray}$$

So, $g(x)=f(x)-((x+1)x+1)$ is a quadratic polynomial that has $3$ zeros and so must be the zero polynomial.

Therefore, $f(x)=(x+1)x+1=x^2+x+1$.

1. Divide f(x) by a so leading co-efficient, let's call it A, is 1.

2. Any quadratic with A = 1 has a parabolic graph, similar to the graph of y = x² apart from a translation ( slide)

To convince yourself, practice with graph and tracing paper, or use Ecxel/Mathematica to draw various graphs of quadratic polynomials with A=+1.

The last step is to determine what the translation , call it (p,q) is.

Use differentiation to find the minimum point of the displaced parabola f(x), and the translation to take it back to (0,0) which is always the minimum point of y=x²

I hope this helps you.

• Why have they provided values of $f(1)$ , $f(2)$ and $f(3)$ as 3, 7 and 13 respectively. Mar 8, 2016 at 12:38
• To allow you to calculate the required Translation; For y = x^2 f(1)=1, f(2)=4 and f(3) = 9. For unknown function triplet is 3,7,13 growing with x increasing, so right side of 'standard' parabola. Between 1 and 2 y grows by 4 , between 2 and 3 y grows by 9. These are 2^2 and 3^2 respectively. This looks like the differential of a cubic curve, which of course is a Quadratic. --- I need to think about this. Mar 8, 2016 at 15:05

You can also consider the 3 dimensional vector space $V$ of functions that map the set $S = \{1,2,3\}$ to the real numbers. The functions $f_1(x) = 1$, $f_2(x) = x$ and $f_3(x) = x^2$ restricted to $S$ are 3 linear independent elements of $V$. Let's define an inner product on $V$:

$$a\cdot b = \sum_{k=1}^{3}a(k) b(k)$$

Then we can construct an orthonormal basis using the functions $f_j(x)$ using the Gram-Schmidt method. We start by normalizing $f_1$ to obtain our first basis vector:

$$e_1(x) = \frac{f_1(x)}{|f_1|} = \frac{1}{\sqrt{3}}$$

We then subtract from $f_2$ the component in the direction of $e_1$:

$$g_2(x) = f_2(x) - (f_2\cdot e_1)e_1(x) = x - 2$$

Normalizing $g_2$ gives us our next basis vector:

$$e_2(x) = \frac{1}{\sqrt{2}}(x-2)$$

Subtracting the components of $f_3$ in the subspace spanned by $e_1$ and $e_2$ yields:

$$g_3(x) = f_3(x) - (f_3\cdot e_1)e_1(x) - (f_3\cdot e_2)e_2(x) = x^2 - 4 x +\frac{10}{3}$$

Normalizing $g_3$ yields the final basis vector:

$$e_3(x) = \sqrt{\frac{3}{2}}\left(x^2 - 4 x +\frac{10}{3}\right)$$

We can now expand the function $f(x)$ in this orthonormal basis:

$$f(x) = \sum_{r=1}^3 (f\cdot e_r) e_r(x) = x^2 + x + 1$$