Quadratic equations / Perfect square

2.2k Views Asked by At

I am dealing with a programming problem and was wondering if there's a general method to solve it. Is there a general way to find 'n' such that: $a^2n^2 + bn - c$ is a perfect square? a, b, c given numbers. In my problem the first term is always a perfect square and the signs don't change. How should I approach this? Thanks a bunch!

2

There are 2 best solutions below

3
On BEST ANSWER

You are given integers $a$, $b$, and $c$, and you want integers $n$, $x$ such that $$a^2n^2+bn-c=x^2$$ Multiply through by $4a^2$: $$4a^4n^2+4a^2bn-4a^2c=4a^2x^2$$ Rewrite as $$(2a^2n+b)^2-b^2-4a^2c=4a^2x^2$$ which is $$(2a^2n+b)^2-(2ax)^2=b^2+4a^2c$$ Now you have to find the ways of expressing $b^2+4a^2c$ as a difference of two squares. That has been discussed here many times, so you can do a search to find out how to do it, or you can work it out yourself. Once you have $$b^2+4a^2c=r^2-s^2$$ for some $r$ and $s$, you can solve $2a^2n+b=\pm r$ for $n$, to see whether you get an integer.

1
On

To make any equation a perfect square follow these steps.... First of all you must realise that the variable to consider here is 'n'. Then make the coefficient of n^2 to unity by dividing throughout the equation. Then add to the equation the square of half the coefficient of n. Simply it to get a perfect square. If you didn't understand it then tell me I'll explain with examples. :)