Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I looked at Predict next number from a series and Next number in series but I did not found the answer I was looking for.

Is it possible to construct a rule for a sequence, that generates arbitrary elements?

For example $x_1, x_2, x_3, x_4$ are given and I have to find $x_5$. Can I come up with a rule which produces $x_{1-4}$ and any possible integer for $x_5$?

share|cite|improve this question
This could be relevant. – fermesomme Dec 15 '14 at 7:18
up vote 1 down vote accepted

In Lagrange interpolation you can create polynomials that are $1$ at one value of $x$ and $0$ at other values. For your example, we have five of them, which will be of fourth degree. We have $p_i(j)=\delta_{ij}$, where $\delta_{ij}$ is the Kroenecker delta, $1$ if $i=j$ and $0$ otherwise. Let $y_i$ be the desired value of the sequence at $x=i$. Then $y=\sum_{i=1}^5 y_ip_i$ is the polynomial you want. There are many other functions that satisfy this. You can add any number times $(x-1)(x-2)\ldots (x-5)$. Instead of polynomials you can use trig functions.

share|cite|improve this answer

Yes, you can by taking an interpolating polynomial, through the 5 points. They are many non polynomial functions also.

For a polynomial example $f(x)=\dfrac{y_1(x-2)}{1-2}+\dfrac{y_2(x-1)}{2-1} +\lambda(x-1)(x-2)$ This takes values $y_1,y_2$ at 1 and 2 and a value depend on $\lambda$ at 3,4,etc.

We can have $f(1)=y_1,f(2)=y_2\dots$ and so on with all the other numbers taking whatever value you want. This is not generally polynomial.

share|cite|improve this answer

You can generate a function which generates arbitrary $x_5$ for given $x_{1-4}$ (hint- look at polynomials of a certain degree.)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.