Fog Creek Software
Discussion Board




Sum it up error

With regards to the 2nd part of the problem, the quadradic equation can not solve equations of the form a^2+b^2=C. The quadradic equation solves problems of the form a^2+b=c, and produces two distinct answers. The form a^2+b^2=c is the equation of a circle with radius c, and therefore has an infinite number of solutions.

As for the code based approaches other have taken, if I were allowed to solve this in code (as opposed to in my head) the simplest answer seems to be just a two-entry window that you slide along the sequence looking for the entries to match up. This assumes, of course, that the repeaters occur next to each other.

Just another kid
Thursday, September 05, 2002

That should be 'of radius root c'...

Just another kid
Thursday, September 05, 2002

>the quadradic equation can not solve equations of the form a^2+b^2=C

Not true.  You can solve for a in terms of b (or vice versa) with no problem.  It's quadratic in a and b.

>The form a^2+b^2=c is the equation of a circle with radius c, and therefore has an infinite number of solutions

Irrelevant.  a^2 + b = c is the equation of a parabola (if a and b are our variables).  Does it imply an infinitude of solutions?  Why is this case different?

I'd suggest you go back and brush up on your algebra.

bmm
Saturday, September 07, 2002

>Irrelevant. a^2 + b = c is the equation of a parabola (if a >and b are our variables). Does it imply an infinitude of >solutions? Why is this case different?

It is absolutely relevant. The whole point of the problem was to find two distinct solutions (representing the two repeating numbers) to the equation a^2+b^2=C. It can not be done because there is an infinite number of solutions. If you _fix_ a or b, then you can find two distinct solutions for that particular equation, via the quadradic formula (or straight algebra in this case), but that really doesnt help us in the context of this problem, does it?

And YES, if a and b are _both variables_ and we have only the equation a^2+b=C, or even a+b=C, then there is an infinitude of solutions.

In case this isn't obvious, let a+b=4, then a=0,b=4 or a=2,b=2, or a=4,b=0 etc etc etc

Same goes for any two variables in a single equation (there may be funny exceptions in non-linear systems of equations, but never having studied them, Im not too sure)


The point behind all this is as I origianlly stated:
To find the two repeating numbers, the equation a^2+b^2=C is of no use, as it does not uniquely define an answer to the repeating number problem.

I'd suggest you go back and brush up on your linear algebra and trig.

Just another kid
Sunday, September 15, 2002

In my first post:
>The quadradic equation solves problems of the form >a^2+b=c

SHOULD read:

The quadradic equation solves problems of the form ax^2+bx=c

Just another kid
Sunday, September 15, 2002

This ought to be my final post.

The author's solution states at the bottom

"a function of the form c2 = a^2 + b^2
which could also be solved by using the quadratic equation."

I believe he meant that the equations
c1 = a+b
c2 = a^2+b^2
used in conjunction could be put in a quadradic form, which is the case.
c1=a+b
-> b=c1-a
-> c2=a^2+(c1-a)^2
-> c2 = 2*a^2 - 2*c1*a + c1^2

Where the A, B, C you plug into the quadradic equation are
2, -2*c1, and c1^2-c2 respectively.


-jak

Just another kid
Sunday, September 15, 2002

Just to clarify: When you solve an equation for x=0, you are finding it's intercept points with the x axis. You can't necessarily solve all equations using the quadratic formula (obviously!:) but just because the quadratic formula does not work, does not mean there are an infinite number of solutions. In the case of a circle (a^2 + b^2 = c) there are at most two intercepts - not an infinite (try drawing it on a piece of paper).

Cheers,
Christo

Christo Fogelberg
Tuesday, October 08, 2002

*  Recent Topics

*  Fog Creek Home