To all who love math: find x to make <quadratic>=a^2; a=int

Page 1 of 1 [ 15 posts ] 

Substantially_Abstract
Raven
Raven

Joined: 15 Jun 2018
Age: 25
Gender: Female
Posts: 111

26 Dec 2022, 3:23 am

So this problem is keeping me up many nights: say, we have a quadratic, q(x)=a*x^2 + b*x + c, and we need to find such integer x, so that q(x)=t^2, for some integer t.

Does anyone here know how to do that?

I first assumed that we can find x just by factoring q(x) into perfect squares, but then some q(x) (that can yield t^2), can not be factored this way...



Joe90
Veteran
Veteran

User avatar

Joined: 23 Feb 2010
Gender: Female
Posts: 26,492
Location: UK

26 Dec 2022, 11:57 am

Image


_________________
Female


Mona Pereth
Veteran
Veteran

Joined: 11 Sep 2018
Gender: Female
Posts: 7,810
Location: New York City (Queens)

27 Dec 2022, 8:50 am

Substantially_Abstract wrote:
So this problem is keeping me up many nights: say, we have a quadratic, q(x)=a*x^2 + b*x + c, and we need to find such integer x, so that q(x)=t^2, for some integer t.

Does anyone here know how to do that?

I first assumed that we can find x just by factoring q(x) into perfect squares, but then some q(x) (that can yield t^2), can not be factored this way...

Is there any reason why we can't just subtract t^2 from both sides of q(x)=t^2, to get:

a*x^2 + b*x + c - t^2 = 0

and then apply the quadratic formula to get the following two roots?

x = (-b + SQRT(b^2 - 4*a*(c - t^2))) / (2*a)

and

x = (-b - SQRT(b^2 - 4*a*(c - t^2))) / (2*a)

Or am I misunderstanding the problem?

(Note: Above, "SQRT(whatever)" means the square root of whatever.)


_________________
- Autistic in NYC - Resources and new ideas for the autistic adult community in the New York City metro area.
- Autistic peer-led groups (via text-based chat, currently) led or facilitated by members of the Autistic Peer Leadership Group.
- My Twitter / "X" (new as of 2021)


Mikah
Veteran
Veteran

User avatar

Joined: 23 Oct 2015
Age: 36
Posts: 3,201
Location: England

27 Dec 2022, 12:20 pm

Mona Pereth wrote:
Or am I misunderstanding the problem?


Yeah I'm not quite sure what kind of answer is desired. Some general relationship between a,b,c and t? There are certainly solutions, if you can factorise a quadratic into the form (zx + y)^2 then all integer values of x satisfy OP's requirements, because if z,x and y are all integers then zx+y (=t) is an integer too.

Btw Mona and everyone else this site is useful for creating readable maths images somewhat quickly: https://latexeditor.lagrida.com/

Here are Mona's roots from the quadratic equation:
Image


in latex that's:
Code:
x = \frac {-b \pm \sqrt{b^2 - 4a(c - t^2)}}{2a}

use "\ " to create spaces and "\newline" or "\\" for new lines.
Can scour google for other latex cheatsheets but above will probably teach you everything you need for this particular problem.

Going along again with the perfect square idea. You could assume q(x) can only be a perfect square to satisfy q(x) = (int t)^2 and factorise q(x) as:
Image

From which you could also find relations, but again I don't really know what we are trying to do here.

in latex:
Code:
q(x) = (\sqrt{a}x - \sqrt{c})^2\\
(\sqrt{a}x - \sqrt{c})^2 = t^2


_________________
Behold! we are not bound for ever to the circles of the world, and beyond them is more than memory, Farewell!


Substantially_Abstract
Raven
Raven

Joined: 15 Jun 2018
Age: 25
Gender: Female
Posts: 111

27 Dec 2022, 4:11 pm

I'm trying to find a general relationship between x and a, b, c, such that x is an integer, and q(x) is t^2 for some integer(s) t.

So t and x are NOT known ahead of time.
But a, b, c ARE known.

Take, for example, the quadratic 36*x^2 + 64*x + 27. What would x have to be so that it equals t^2 for some integer t? Can we generalise this for any given quadratic?



magz
Forum Moderator
Forum Moderator

User avatar

Joined: 1 Jun 2017
Age: 39
Gender: Female
Posts: 16,283
Location: Poland

27 Dec 2022, 4:31 pm

Oh, integers - which means we're entering the realm of Number Theory.

There's the case Mikah mentioned - a factorization:
If you can represent a*x^2+b*x+c as (p*x+r)^2, then simply t=+-(p*x+r). If p and r are integers, every t is an integer for every integer x.
For such a and b, t is an integer for every integer x.

But the funny cases would be the non-trivial ones where p and r aren't integers and possibly not even real numbers. Would there still be some solutions?

I'm after my sleeping pill, so maybe tomorrow.


_________________
Let's not confuse being normal with being mentally healthy.

<not moderating PPR stuff concerning East Europe>


naturalplastic
Veteran
Veteran

User avatar

Joined: 26 Aug 2010
Age: 69
Gender: Male
Posts: 33,873
Location: temperate zone

27 Dec 2022, 5:08 pm

Where is Will Hunting (the janitor who looks like Matt Damon) when you need him? I just saw the movie on DVD so was reminded of it.



magz
Forum Moderator
Forum Moderator

User avatar

Joined: 1 Jun 2017
Age: 39
Gender: Female
Posts: 16,283
Location: Poland

28 Dec 2022, 8:15 am

Without meds aimed at making the brain sleep:

If you have Δ=0, you have the case Mikah described and simple divisibility will work.
I assume that case has been already investigated by OP.
If you have Δ≠0, you can't find t(x)=p*x+q (you'd get contradicting equations).

For t^2=c (if sqrt(c) is integer), I see x=0 or x=-b/a.

It will be generally a hunt for special cases of b^2-4*a*(c-t^2) being a quadratic integer to get at least rational solutions and then finding the integer options within it. I don't see this possible for arbitrary a, b and c.

If b^2-4*a*c=0, you have the perfect square option and any t will give rational results if a is quadratic.


_________________
Let's not confuse being normal with being mentally healthy.

<not moderating PPR stuff concerning East Europe>


Fenn
Veteran
Veteran

User avatar

Joined: 1 Sep 2014
Gender: Male
Posts: 2,404
Location: Pennsylvania

28 Dec 2022, 12:11 pm

Don’t have time to look at this in detail but

I often use newtons method when integers and square roots and mental math is involved. Useful for finding square roots, cube roots and local minima and maxima for well behaved (not fractal) functions.

When using a computer brute force often turns up answers with less time and work. Unless “don’t use a computer” is part of the problem - or the search space is orders of magnitude greater that a typical brute force search can address (like cryptographic math)


_________________
ADHD-I(diagnosed) ASD-HF(diagnosed)
RDOS scores - Aspie score 131/200 - neurotypical score 69/200 - very likely Aspie


Mona Pereth
Veteran
Veteran

Joined: 11 Sep 2018
Gender: Female
Posts: 7,810
Location: New York City (Queens)

29 Dec 2022, 5:53 pm

If x and t are both unknown, this is a multi-variable quadratic equation.

I've been trying to find a good online tutorial about this but I'm having difficulty finding one.

EDIT: The most relevant-looking tutorial I've been able to find is: Conic Sections and Standard Forms of Equations, which contains the following:

Quote:
The general equation for any conic section is:

Ax^2+Bxy+Cy^2+Dx+Ey+F=0
where A,B,C,D,E and F are constants.

Your problem does fit that form.


_________________
- Autistic in NYC - Resources and new ideas for the autistic adult community in the New York City metro area.
- Autistic peer-led groups (via text-based chat, currently) led or facilitated by members of the Autistic Peer Leadership Group.
- My Twitter / "X" (new as of 2021)


Substantially_Abstract
Raven
Raven

Joined: 15 Jun 2018
Age: 25
Gender: Female
Posts: 111

31 Dec 2022, 9:26 am

Interesting answers, everyone!

As a side note: does anyone know of any program, which can calculate roots of any polynomial, even without concrete coefficients (e.g. a*x^6+(a-b)*x^5+x+61==0)? I've so far tried wolfram alpha, but it said I've exceeded its maximum number of characters...

Happy upcoming New Year!! !



magz
Forum Moderator
Forum Moderator

User avatar

Joined: 1 Jun 2017
Age: 39
Gender: Female
Posts: 16,283
Location: Poland

31 Dec 2022, 10:30 am

Wolfram Mathematica - but over degree 4, there may be no general theoretical solution existing and over some level of complication, the program won't find even the existing ones.


_________________
Let's not confuse being normal with being mentally healthy.

<not moderating PPR stuff concerning East Europe>


Mikah
Veteran
Veteran

User avatar

Joined: 23 Oct 2015
Age: 36
Posts: 3,201
Location: England

31 Dec 2022, 11:33 am

Substantially_Abstract wrote:
Interesting answers, everyone!

As a side note: does anyone know of any program, which can calculate roots of any polynomial, even without concrete coefficients (e.g. a*x^6+(a-b)*x^5+x+61==0)? I've so far tried wolfram alpha, but it said I've exceeded its maximum number of characters...

Happy upcoming New Year!! !


This one can't do unknown coefficients, but is nonetheless an impressive root finder: https://www.mathportal.org/calculators/ ... ulator.php


_________________
Behold! we are not bound for ever to the circles of the world, and beyond them is more than memory, Farewell!


Fenn
Veteran
Veteran

User avatar

Joined: 1 Sep 2014
Gender: Male
Posts: 2,404
Location: Pennsylvania

01 Jan 2023, 12:31 pm

Mikah wrote:
Mona Pereth wrote:
Or am I misunderstanding the problem?


Yeah I'm not quite sure what kind of answer is desired. Some general relationship between a,b,c and t? There are certainly solutions, if you can factorise a quadratic into the form (zx + y)^2 then all integer values of x satisfy OP's requirements, because if z,x and y are all integers then zx+y (=t) is an integer too.

Btw Mona and everyone else this site is useful for creating readable maths images somewhat quickly: https://latexeditor.lagrida.com/

Here are Mona's roots from the quadratic equation:
Image


in latex that's:
Code:
x = \frac {-b \pm \sqrt{b^2 - 4a(c - t^2)}}{2a}

use "\ " to create spaces and "\newline" or "\\" for new lines.
Can scour google for other latex cheatsheets but above will probably teach you everything you need for this particular problem.

Going along again with the perfect square idea. You could assume q(x) can only be a perfect square to satisfy q(x) = (int t)^2 and factorise q(x) as:
Image

From which you could also find relations, but again I don't really know what we are trying to do here.

in latex:
Code:
q(x) = (\sqrt{a}x - \sqrt{c})^2\\
(\sqrt{a}x - \sqrt{c})^2 = t^2


If I could up-vote this post I would. Didn’t know about the latex-to-gif on-line services. Great stuff.


_________________
ADHD-I(diagnosed) ASD-HF(diagnosed)
RDOS scores - Aspie score 131/200 - neurotypical score 69/200 - very likely Aspie


Fenn
Veteran
Veteran

User avatar

Joined: 1 Sep 2014
Gender: Male
Posts: 2,404
Location: Pennsylvania

01 Jan 2023, 12:55 pm

I took a class in college called “Discrete Mathematics” that dealt specifically with Integer math. The rules for Integers are almost the same but not quite for reals. For example we proved things like all primes greater than 3 are either a multiple of 6 plus one or a multiple of 6 minus one, and how any multiple of nine will produce a number whose digits add up to 9 or a smaller multiple of 9.

Not all integers have an integer square root. Because of this using square root in algebra related to integer math is not always “legal” and may even produce false results if you are not careful. I am a computer scientist. Computers mostly use integers to represent numbers, some times fixed point (all numbers have a fixed number of decimal digits to the right of the decimal) or floating point (all numbers are represented by a fixed point number coupled with a power of 10 [or 2] to multiply the fixed point number by, and a sign-bit 0 meaning positive and 1 meaning negative). I was able to adapt to the “Discrete Mathematics” way of thinking better than many of the Math majors because of my experience with computer math.

Google “Discrete Mathematics” to learn more.


_________________
ADHD-I(diagnosed) ASD-HF(diagnosed)
RDOS scores - Aspie score 131/200 - neurotypical score 69/200 - very likely Aspie