Extracting an element from a circular array using purely algebraic means/function?

42 Views Asked by At

Please be patient with this as this might appear a somewhat strange Q.

Given a fixed sized circular array $A_0$ with $N$ elements ($5\leq N$). We can choose any reasonable $N$ (either even or odd) according to our convenience. We DO NOT know the initial element where we are pointing in the given array but we can traverse through circular the array both forwards and backwards to read the values. . This array consists of at least 1 and at most 2 ordered non zero positive real numbers that are always consecutive $(r_0, r_1)$of the following form:

$(0 \leq r_0 < 1)$ and $(r_1=1-r_0)$

Some examples: [0, 0, 0, .9, .1] , [.7, 0, 0, 0, .3] , [0, 0, .5, .5, 0] , [0, 0, 0, 0, 1], [1, 0, 0, 0, 0]

The $(r_0, r_1)$ pairs in above are: (.9, .1); (.3, .7); (.5, .5); (0, 1); (0, 1).

Problem: for any such fixed size array purely using algebraic operations (such that each step of the process is completely integrable. Thus, we are not allowed to use conditional or symbolic statements such as if-else, modulus etc.) we have to achieve the following: Create an algebric formula to recover the value of $r_0$ from the array.

My approach:

  1. Traverse the array in clockwise direction and calculate the following sums: $S_0=\Sigma(v_i)^2*(v_{i+1})$ and $S_1=\Sigma(v_i)*(v_{i+1})$
  2. Since at most two elements are non zero this sum is equivalent to: $S_0=(r_0)^2*r_1$ and $S_1=r_0*r_1$
  3. Create an algebraic formula to extract the common root from the values $S_0$ and $S_1$ and formulas: $S_0=(r_0)^2*r_1$ and $S_1=r_0*r_1$

But the problem occurs in the case where $r_0=0$ since both $S_0=(r_0)^2*r_1$ and $S_1=r_0*r_1$ will give $0=(r_0)^2*r_1$ and $0=r_0*r_1$. Now this equation can be satisfied with either $r_0=0$ or $r_0=1$. But this means that we will struggle to extract a single value in this case.

The steps must lead to an algebraic formula (that is completely integrable) and gives a single value $r_0$ as output.

I am struggling for a few days but I don't see the way out when there are two roots. Can someone please help? There has to be a way out but I can't see one.