2
$\begingroup$

I am trying to find a function generating/suitable for the following sequence:
${2,6,12,20,30,42,56...}$

The first order differences are:
$4, 6, 8, 10, 12, 14...$

and the second order differences are:
$2, 2, 2, 2, 2, 2...$

this means that:
$y''= 2 \implies y' = 2\cdot x + c$ and we can see that for $c = 2$ we can get the correct numbers i.e. the first order differences (replacing starting from $x = 1$). So $y' = 2\cdot x + 2$
This means that $y = x^2 + 2\cdot x + c$
But I can't find any value of $c$ that would give the original sequence.

Now I see that $y'$ could also be $y' = 2\cdot x + 4$ as it gives the correct numbers if we replace starting from $x = 0$ but then we have $y = x^2 + 4\cdot x + c$ and I again can't find any $c$ that matches the original sequence.

What am I doing wrong here?

$\endgroup$
6
  • $\begingroup$ Well, inspection gives $a_n=n(n+1)$ $\endgroup$
    – lulu
    Apr 6, 2022 at 17:00
  • $\begingroup$ You've figured out $x_{n+1}-x_n = 2n+2$, $x_1 = 2$, so try working recursively. (wolframalpha.com/…) $\endgroup$
    – User203940
    Apr 6, 2022 at 17:06
  • $\begingroup$ @User203940: Isn't that is $y'$ though? That is why I go towards $n^2 + 2$. Otherwise I am confused here $\endgroup$
    – Jim
    Apr 6, 2022 at 17:07
  • $\begingroup$ When you say "function generating" this sequence, do you mean an explicit formula for the $n$-th term, or do you mean the literal generating function? $\endgroup$
    – user170231
    Apr 6, 2022 at 17:16
  • $\begingroup$ @user170231: the generating function. Is there a difference with the formula for the $n-th$ term? $\endgroup$
    – Jim
    Apr 6, 2022 at 18:21

2 Answers 2

3
$\begingroup$

You start with the sequence $y=2,6,12,20,30,42,56$ when $x=1,2,3,\dots$.

You have found that $y(2)-y(1)=4, y(3)-y(2)=6, y(4)-y(3)=8,\dots$, but this is not the same as finding $y'(1), y'(2),\dots$, because the value of $y'$ is not constant over these intervals.

In fact, since $y'$ changes linearly (for $y$ is a quadratic), you have actually found $y'(1.5),y'(2.5),y'(3.5),\dots=4,6,8,\dots$ i.e. these numbers $4,6,8,\dots$ are the average rate of change across the intervals $[1,2],[2,3],\dots$, which happens to be the exact rate of change at the midpoint of the interval.

For $y''$, which is constant everywhere, this nuance does not matter: $y''=2$ and you have correctly concluded that $y$ will have a term of $x^2$ (with coefficient $1$).

However, for the coefficient of $x$, you need to note that $y'(1.5)=4$ so if $y=x^2+bx+c$ then $y'=2x+b$, so $y'(1.5)=2\times 1.5+b=4\implies b=1$.

Thus, we have that $y=x^2+x+c$ and by comparing sequences, we see $c=0$.


Sequences are not generally thought of in these terms of raw calculus, which studies continuous change over $\mathbb{R}$ rather than discrete changes over $\mathbb{N}$. Instead, we might study recurrence relations.

A method often used for identifying quadratics would be to just find the $x^2$ coefficient by halving the difference of differences (here, $2$) and then subtract that off the original sequence to see what you're left with: $2,6,12,20,30,\dots-1,4,9,16,25,\dots=1,2,3,4,5,\dots$. In general, you know this sequence will be linear; here, you can just see outright it is the identity sequence $x$, so the full sequence is $x^2+x$.

In this case, as a commenter said, you could possibly spot the solution outright: if you notice the numbers are all times tables values you might see $56=7\times 8,42=6\times 7,30=5\times 6$ and conclude $y=x\times (x+1)$.

$\endgroup$
4
  • 1
    $\begingroup$ "are the average rate of change across the intervals $[1,2],[2,3],\dots$, which happens to be the exact rate of change at the midpoint of the interval." I can understand that because the change is linear and we have the change across $1$ unit, we have the rate of change from $[2,3]$ to be $\frac{12-6}{3-2}=\frac{6}{1}=6$. But how do we infer that it is the exact change at the midpoint? I.e. $2.5$? $\endgroup$
    – Jim
    Apr 7, 2022 at 8:46
  • $\begingroup$ @Jim we know the gradient from $2$ to $3$ is a straight line and the average value on this line segment is $6$, because $y(3)-y(2)=\int_2^3 y'(x) dx=6$. The average value (by thinking about integration as area) also happens to be the area underneath the line segment. This area - a triangle plus a rectangle - is the same area as underneath a horizontal line that passes through the midpoint i.e. $\int_2^3 \frac{1}{2}(y(3)-y(2)) dx$. Sketch it out with some different lines and values. $\endgroup$
    – A.M.
    Apr 7, 2022 at 9:33
  • 1
    $\begingroup$ "we know the gradient from 2 to 3 is a straight line" we know this because of the second differences which are constant right? Otherwise I am not sure how do we infer this $\endgroup$
    – Jim
    Apr 7, 2022 at 10:02
  • $\begingroup$ @Jim yes, correct. $\endgroup$
    – A.M.
    Apr 7, 2022 at 10:27
2
$\begingroup$

Let $\{a_n\}_{n\in\mathbb N}=\{2,6,12,20,30,42,56,\ldots\}$. Let $\{b_n\}_{n\in\mathbb N}$ be the sequence of the first-order forward differences of $\{a_n\}$, and $\{c_n\}_{n\in\mathbb N}$ the sequence of second-order differences. So for $n\ge1$,

$$b_n = a_{n+1} - a_n \\ c_n = b_{n+1} - b_n$$

As you observed, $c_n=2$ for all $n$. Then

$$\begin{align*}b_{n+1} &= b_n + 2 \\ &= b_{n-1}+2\times2 \\ &= b_{n-2}+3\times2 \\ &~~\vdots \\ &= b_1 + 2n \end{align*}$$

which means $b_n = b_1+2(n-1)=2(n+1)$.

Now solve for $a_n$:

$$\begin{align*} a_{n+1} &= a_n + 2(n+1) \\ &= a_{n-1} + 2((n+1) + n) \\ &= a_{n-2} + 2((n+1) + n + (n-1)) \\ &~~\vdots \\ &= a_1 + 2 \sum_{k=0}^{n-1} (n+1-k)\\ &= a_1 + n^2 + 3n \end{align*}$$

so that $a_n = 2 + (n-1)^2 + 3(n-1) = n^2 + n$.

In case you are interested in the generating function, it takes the form

$$f(x) = \sum_{n=0}^\infty a_n x^n$$

Recall that if $|x|<1$, we have

$$\frac1{1-x} = \sum_{n=0}^\infty x^n$$

and finding $f(x)$ is just a matter of differentiating both sides twice.

$$\frac1{(1-x)^2} = \sum_{n=0}^\infty nx^{n-1} = \sum_{n=1}^\infty nx^{n-1} = \sum_{n=0}^\infty (n+1)x^n$$

$$\frac2{1-x^3} = \sum_{n=0}^\infty (n^2+n) x^{n-1}$$

$$\implies f(x) = \frac{2x}{1-x^3} = \sum_{n=0}^\infty (n^2+n) x^n$$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .