# [GAP Forum] Re: cubic equations

Nikos Apostolakis nikos.ap at gmail.com
Sat Feb 9 19:45:57 GMT 2008

```On Sat, Feb 09, 2008 at 08:11:22AM -0800, thus spake muniru asiru:
> Dear Forum,
>
> Please assist me in programming Gap to find x(rational
> number) and y(integer number) so that
> (y-1)x^3+yx^2+(y+1)x-y=0,  y<>1.
>
> The only solutions I got is (x,y)=(1/2,3).  Could
> anyone help find others?
>

Two more solutions are (1,0) and (56/103, - 418488) if there is an other
solution with x > 0 the denominator of x is larger than 1000.

I used maxima to symbolicaly solve the equation to get that the general
solution is

[y = (x^3-x)/(x^3 + x^2 + x -1)]

then still using maxima we substitute x = m/n to get:

y = (m*n^2 - m^3)/(n^3 - m*n^2 - m^2*n - m^3)

Then using Gap (since this is Gap forum ;)) I did:

Filtered(Cartesian([1..1000], [1..1000]), x -> IsInt((x[1]*x[2]^2-x[1]^3)/(x[2]^3-x[1]*x[2]^2-x[1]^2*x[2]-x[1]^3)));;
List(last, x -> x[1]/x[2]);;
Collected(last); #==> [ [ 1/2, 500 ], [ 56/103, 9 ], [ 1, 1000 ] ]

Of course the above is a quick"brute force" approach.  Perhaps there is a more
elegant way.

HTH,
Nikos

> Thanks
>
> maasiru
>

```