Write an expression in terms of $n$ for the $n$th term in the following sequence: $9,16,25,36,49$

Write an expression in terms of $n$ for the $n$th term in the following sequence: $9,16,25,36,49$

The difference is $+ 7 , + 9 , + 11 , + 13, + 15 , + 17 ,$ etc

The difference is not constant so it's not so straightforward . Is there any hint or secrets in solving these sorts of questions?


$$a_\color{blue}{1}=9=3^2=(\color{blue}{1}+2)^2$$ $$a_\color{blue}{2}=16=4^2=(\color{blue}{2}+2)^2$$ $$a_\color{blue}{3}=25=5^2=(\color{blue}{3}+2)^2$$ $$\cdots$$ $$a_\color{blue}{n}=(\color{blue}{n}+2)^2$$


By inspection, the numbers in this sequence are successive perfect squares. That observation enabled Roman83 to determine the formula $a_n = (n + 2)^2$.

You approached the problem by using the method of finite differences. However, using the first difference only works if the equation is linear. Observe that the second differences are constant.

Let $a_n$ be the $n$th term of the sequence. Then $$ \begin{array}{c c c c} n & a_n & \Delta_n = a_{n + 1} - a_n & \Delta \Delta_n = \Delta_{n + 1} - \Delta_n\\ \hline 1 & 9 & 7 & 2\\ 2 & 16 & 9 & 2\\ 3 & 25 & 11 & 2\\ 4 & 36 & 13 & 2\\ 5 & 49 & 15 & 2 \end{array} $$

Observe that \begin{align*} a_2 = 16 & = 9 + 7 = a_1 + \Delta_1\\ a_3 = 25 & = 9 + 7 + 9 = a_1 + \Delta_1 + \Delta_2\\ a_4 = 36 & = 9 + 7 + 9 + 11 = a_1 + \Delta_1 + \Delta_2 + \Delta_3\\ a_5 = 49 & = 9 + 7 + 9 + 11 + 13 = a_1 + \Delta_1 + \Delta_2 + \Delta_3 + \Delta_4 \end{align*} In general, $$a_n = a_1 + (\Delta_1 + \Delta_2 + \cdots + \Delta_{n - 1})$$ Also, observe that \begin{align*} \Delta_2 & = 9 = 7 + 2 = \Delta_1 + \Delta \Delta_1\\ \Delta_3 & = 11 = 7 + 2 + 2 = \Delta_1 + \Delta \Delta_1 + \Delta \Delta_2\\ \Delta_4 & = 13 = 7 + 2 + 2 + 2 = \Delta_1 + \Delta \Delta_1 + \Delta \Delta_2 + \Delta \Delta_3\\ \Delta_5 & = 15 = 7 + 2 + 2 + 2 + 2 = \Delta_1 + \Delta \Delta_1 + \Delta \Delta_2 + \Delta \Delta_3 + \Delta \Delta_4 \end{align*} In general, $$\Delta_n = \Delta_1 + (\Delta\Delta_1 + \Delta\Delta_2 + \cdots + \Delta\Delta_{n - 1})$$

We know that $\Delta_1 = 7$ and that $\Delta\Delta_k = 2$ for each $k$. Hence, $$\Delta_k = 7 + 2(k - 1) = 5 + 2k$$ Thus, \begin{align*} a_n & = 9 + (\Delta_1 + \Delta_2 + \cdots + \Delta_{n - 1})\\ & = 9 + \sum_{k = 1}^{n - 1} (5 + 2k)\\ & = 9 + \sum_{k = 1}^{n - 1} 5 + \sum_{k = 1}^{n - 1} 2k\\ & = 9 + 5\sum_{k = 1}^{n - 1} 1 + 2\sum_{k = 1}^{n - 1} k\\ & = 9 + 5(n - 1) + 2 \cdot \frac{n(n - 1)}{2}\\ & = 9 + 5(n - 1) + n(n - 1)\\ & = 9 + 5n - 5 + n^2 - n\\ & = n^2 + 4n + 4\\ & = (n + 2)^2 \end{align*} In general, if the $n$th finite difference is a constant, then the sequence satisfies a polynomial of degree $n$. Consequently, we could have posited a solution of the form $a_n = c_2n^2 + c_1n + c_0$. Substituting the values for $a_1$, $a_2$, and $a_3$ then gives the system of three equations and three unknowns \begin{align*} c_2 + c_1 + c_0 & = 9\\ 4c_2 + 2c_1 + c_0 & = 16\\ 9c_2 + 3c_1 + c_0 & = 25 \end{align*} which you can solve to verify the formula given above.


Call your sequence $a_n$. Let $\Delta a_n$ represent the operation $a_{n+1}-a_{n}$. Note it is possible $\Delta \Delta a_n=2$

In other words if you take the differences of your differences you have:

$$2,2,2,2,2..$$

And we can guess all the terms to be $2$ if we like.

From the binomial theorem we have if and only if $p(n)$ is a degree $n \geq 1$ polynomial then $\Delta p(n)$ is degree $n-1$. So if $\Delta \Delta a_n=2$, $\Delta \Delta a_n$ is degree $0$ then $\Delta a_n$ is degree $0+1=1$ and $a_n$ is degree $1+1=2$.

So:

$$c_2n^2+c_1n+c_0=a_n$$

Now plug in $3$ terms and solve the system of equations. Or if you wish you can just use the inverse of the backwards difference function twice. Note this telescoping sum:

$$\sum_{x=0}^{n-1} \Delta a_n=-a_0+a_n$$

$$a_0+\sum_{x=0}^{n-1} \Delta a_n=a_n$$

So if we take $\Delta a_0$ to represent the first term in the difference sequence $\Delta a_n$ we have:

$$\Delta a_n=7+\sum_{x=0}^{n-1} 2$$

And if we take $a_0$ to be the first term in the sequence $a_n$:

$$a_n=9+\sum_{x=0}^{n-1} 7+\sum_{x=0}^{n-1} \sum_{y=0}^{x-1} 2$$

$$a_n=n^2+6n+9$$

That is, if we take $a_0$ to be the initial term (first one). If you want $a_1$ to be the first term you just need to shift everything to the right one:

$$a_n=(n-1)^2+6(n-1)+9$$

$$a_n=n^2-2n+1+6n-6+9$$

$$a_n=n^2+4n+4$$

$$a_n=(n+2)^2$$

This is a general method. For example say we have:

$$2,8,23,25,..$$

And we want to model it with a polynomial.

Then the difference is :

$$6,15,2,...$$

The difference again:

$$9,-13,..$$

And again

$$-22,..$$

Now suppose this sequence is constant (this will cause us to get a polynomial of lowest degree). Then if we take $a_0$ to be the first term we have:

$$a_n=2+\sum_{x_0=0}^{n-1} 6+\sum_{x_0=0}^{n-1} \sum_{x_1=0}^{x_0-1} 9+ \sum_{x_0=0}^{n-1} \sum_{x_1=0}^{x_0-1} \sum_{x_2=0}^{x_1-1} -22$$

$$=2{n \choose 0}+6{n \choose 1}+9{n \choose 2}+(-22){n \choose 3}$$

$$=2+6 \left( \frac{n}{1!} \right)+9 \left( \frac{n(n-1)}{2!} \right)+(-22) \left(\frac{n(n-1)(n-2)}{3!} \right)$$

See a pattern?

Let me note that $2,6,9,-22$ are the first terms (the initial term with subscript 0) of $a_n,\Delta a_n, \Delta \Delta a_n, \Delta \Delta \Delta a_n$ in this order.