Some Context
I found myself confronting a mathematical meme on Facebook (try not to laugh):
Clearly, this is a simple problem which can be solved by first looking at each number as if they’re elements in a 2-dimensional grid, then using subtraction to find changes. Intuitively, I’m sure everyone would start from the top of the imaginary grid in this case, then analyze the problem first evaluating the rows as linear sets.
Change would be the difference between two elements. If there are only two elements, and you had to predict what would come right after those two elements, your best guess would be to add the difference between the numbers you started with to the leftmost element in the sequence (I’m assuming).
The Questions
The problem I’m having trouble wrapping my head around is the inferring process — the whole process seems vague and far too innate for me to systematize. How did I come up with the answer? Was my brain doing a special operation? If so, what is the operation? Without looking at every row and column, only choosing one linear set, how am I finding a relationship between the three numbers? Is there a way to make an accurate guess of what the relationship between each element is? If not, is there a minimum number of elements that need to be present in order to make an adequate attempt at concluding a likely pattern?
I understand that computers are being forced to go through this process as they learn in unsupervised fashion, and I know that the field of artificial intelligence is relatively new and underdeveloped, so I’m not expecting absolute answers. I’m moreso asking for a good approach if finding a pattern from three elements of a linear set is possible. Perhaps, by asking this question, I’ll gather relevent search queries of considerable specificity.
2
Answers
Basically, you’re trying to fit numbers into the set of all equations with some number of variables, which is infinite and probably not countable (thus probably not too easy to iterate through). Though I’m sure there has been research on exactly the problem you’re trying to solve, but I’ll give my take.
While greatly problem dependent, I suspect what sometimes happens in the human brain is some sort of pattern recognition or matching. You see
5 30 6
, you’re familiar with5 * 6 = 30
, so your mind links those 2. Or the brain, when trying to link numbers, tries common operations like adding, subtracting, multiplying or dividing 2 of them and checking if that results in the 3rd.For such simple problems with such small numbers you can (on a computer) just store all possibilities for
+
,-
,*
and/
(and possibly others) and do a lookup, or just calculate all of those on the fly.For more difficult problems I suspect the brain just runs through a bunch of possibilities of equations.
For a sequence
4,5,6,x
, you could try some of the below: (note that we’re also using the positions of the number with it in an equation, so1
with4
,2
with5
,3
with6
)You’d (hopefully) get that
4a + 5b = 5a + 6b
would be the equation of choice here, withb = 1
anda = -1
.Once you have the required parameters (
a
andb
), you could just plug it into the equation to determine the next value.Looking into Geometric and Arithmetic series may be of some help.
When not dealing with series, how to pick which numbers may be related? Well, just run across rows, columns, diagonals, neighbouring values and whatever else that is applicable or that you can think of.
Concerning linear successions, you can try to make a pre-set patterns and try to recognize them.
The common patterns are arithm./geom. progressions, Fibonacci, something like
a(n) = (n - n1)(n - n2)
(you can see this in 2, 6, 12, 20 succession) etc. So you can define an equations by yourself to check if the succession fits the pattern. For example, in thea(n) = (n - n1)(n - n2)
case you can use first 2 numbers to find out n1 and n2 and then check the remaining numbers for validity.As you can see, there are a lot of patterns that can seem common to human, and it is too hard to implement it programmarically. I don’t want to tell that it is impossible to do, but as far as your program will learn new patterns, the fault rate will grow further since different patters soon will start to fit same successions.
It was stated by
Daniel Fischer
in the comments to the question, that any succession of numbers can fit infinite number of rules. By that means you can state that the next number for any succession will be 42.To describe this, let us take the 1, 2, 3, 4, 5 succession. You may think that it is an arithmetic succession and the next number is 6, but I’d say that it is the results of P(n), where P(n) is a Lagrangian polynomial with the power of 5, that goes through points {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 42)}. And you would never know which answer is right.