# Solving Complicated Systems of Equation

If I have three equations as below:

$$a_j = -(k+\sum_{i\neq j}^n\alpha_iba_i)^{-1}$$, say $$i,j=1,\cdots,n$$.

I want to use Mathematica to solve this system of equations but I do not want to solve it completely for $$a_1,\cdots,a_n$$. I only want an equation of expression of $$a_1$$. For example, in the case of $$n=2$$, I have

$$a_1=-(k+\alpha_1ba_2)^{-1}$$ and $$a_2=-(k+\alpha_2ba_1)^{-1}$$. Putting second equation into the first equation, I get $$a_1=-(k+\alpha_2 b(-k+\alpha_2ba_1)^{-1})^{-1}$$. I only need this expression but not to solve completely to get a value for $$a_1$$. Is there any way to do something like this for Mathematica?

• Yes, it is hard in general. Can you please provide some background. Where these equations are coming from? Jun 13, 2021 at 13:35
• Please provide code for an example, in a form that can be copy/pasted. Jun 13, 2021 at 15:43

The first element of the Gröbner basis gives what you want; but it's rather hard to compute. According to the documentation,

GroebnerBasis[{poly1,poly2,…},{x1,x2,…},{y1,y2,…}] finds a Gröbner basis in which the $$y_i$$ have been eliminated.

So we are looking for a polynomial in $$a_1$$ that has the same zeros as the given equations $$a_j=eq(n,j)$$ but where $$a_2\ldots a_n$$ have been eliminated:

eq[n_Integer, j_Integer] /; 1 <= j <= n :=
-1/(k + Sum[Boole[i != j] α[i] b a[i], {i, n}])

sol1[n_Integer /; n >= 1] :=
First@GroebnerBasis[Table[a[j] == eq[n, j], {j, n}],  (* equations          *)
{a[1]},                           (* keep this variable *)
Table[a[j], {j, 2, n}]]           (* eliminate these    *)

sol1[1] == 0
(*    1/k + a[1] == 0    *)

sol1[2] == 0
(*    k + k^2 a[1] + b a[1] α[1] + b k a[1]^2 α[1] - b a[1] α[2] == 0    *)

sol1[3] == 0
(*    -k^2 + k^4 a[1]^2 - 2 b k a[1] α[1] + 2 b k^2 a[1]^2 α[1] +
4 b k^3 a[1]^3 α[1] - b^2 a[1]^2 α[1]^2 + 4 b^2 k a[1]^3 α[1]^2 +
5 b^2 k^2 a[1]^4 α[1]^2 + 2 b^3 a[1]^4 α[1]^3 + 2 b^3 k a[1]^5 α[1]^3 -
2 b k^2 a[1]^2 α[2] - 4 b^2 k a[1]^3 α[1] α[2] -
2 b^3 a[1]^4 α[1]^2 α[2] + b^2 a[1]^2 α[2]^2 - 2 b k^2 a[1]^2 α[3] -
4 b^2 k a[1]^3 α[1] α[3] - 2 b^3 a[1]^4 α[1]^2 α[3] -
2 b^2 a[1]^2 α[2] α[3] + b^2 a[1]^2 α[3]^2 == 0    *)


For $$n=4$$ it's already taking too long.