Finding if there relationship between numbers

77 Views Asked by At

I have a challenge. This may be little tricky or even not possible but wanted to check if anyone has any thoughts on this?

PS : This question is in general and not related to only to R. May be I can say its general mathematics

I have a data

df
ColA    ColB    ColC
 6       9       27
 1       4       32
 4       8       40

If you observe closely, there is some relationship between these columns.

Example, (ColC/ColB)+ColA will give you number 9.

df
ColA    ColB    ColC   ColD
 6       9       27     9
 1       4       32     9
 4       8       40     9

However this data is manipulated and I made sure there is some relation. But in general, lets us take any numbers, is there a way to find if there is any relationship between these numbers. Need not be (ColC/ColB)+ColA . It could be anything.

Say we have 5 columns of numeric data. I need to find mathematical operation between these so that common number exists.

This is more into mathematics(algebra). Can anyone let me know is this even possible ?

2

There are 2 best solutions below

1
On

For finitely many given points in $\Bbb Q^3$ we can find a polynomial $f(x,y,z)\in \Bbb Q[x,y,z]$, which vanishes at these points. For example, for your points $$ u=(6,9,29), v=(1,4,32), w=(4,8,40) $$ the polynomial you have found is $$ f(x,y,z)=xy-9y+z. $$ Indeed $f(u)=f(v)=f(w)=0$, and this corresponds to your "rule" $\frac{z}{y}+x=9$.

On the other hand, there are many more choices. For example, we can also find $$ f(x,y,z)=4x^2 - 35xy + 4xz + 264x - 2yz $$ Then also $f(6,9,27)=f(1,4,32)=f(4,8,40)=0$. This looks more complicated, but it shows that we have many choices, and that this will work.

For reference see Polynomial interpolation in several variables.

0
On

But in general, lets us take any numbers, is there a way to find if there is any relationship between these numbers. Need not be (ColC/ColB)+ColA . It could be anything.

The 'it could be anything' makes this problem trivial. As Ivan points out in the comments, you can always do:

$$ColA*0+ColB*0+ColC*0 ...$$

or (if you don;t want to use constants in your formula):

$$(ColA-ColA)+(ColB-ColB)+(ColC-ColC) ...$$

both of which will always return $0$

So, to make this an interesting problem, you'll need to put some constraints on the formula, e.g.

  • Are constants allowed?

  • Can you have multiple instances of $ColA$ (and same for others)?

  • And most importantly: What operators are allowed? Addition, subtraction, multiplication, division, exponentiation, square root, etc. etc. ?

Note that if constants are not allowed, if you can use only one (or some predefined limited number of) instances of $ColA$, and restrict yourself to a fixed and defined number of operators, then there are only finitely many formulas that you can make, and so a computer would be able to quickly go through all those and see if something works.