What is my mistake in finding this pythagorean triplet?

193 Views Asked by At

Since Project Euler copyright license requires that you attribute the problem to them, I'd like to add that this is about question 9 there.

I am trying to solve this problem on only two brain cells and can't figure out what am I doing wrong. Here is the system for $(a, b, c) \in \mathbb{N}^3$,

\begin{align*} a^2 +b^2 &= c^2 \\ a+ b + c &= 1000 \\ a &< b < c \end{align*}

Here is my approach,

\begin{align*} a + b + c &= 1000 \\ a + b &= 1000 - c &&\text{Subtract } c\\ a^2 + b^2 + 2ab &= 1000^2 + c^2 - 2000c &&\text{Square both sides}\\ c^2 + 2ab &= 1000^2 + c^2 - 2000c &&\text{Since }a^2 +b^2 = c^2\\ 2ab &= 1000^2 - 2000c &&\text{Subtract } c^2\\ \frac{ab}{500} &= 1000 - 2c &&\text{Divide } 1000\\ 2c &= 1000 - \frac{ab}{500} &&\text{Rearrange}\\ \end{align*}

Now let $a=5,b=200$,

\begin{align*} 2c &= 1000 - 2\\ 2c &= 998 \\ c &= (998 \div 2) = 499 \\ \end{align*}

But certainly these values do not work. I can't see why.

4

There are 4 best solutions below

0
On

I think this comment by @MatthewLeingang explaining @lulu's comment answers the issue with my approach.

What lulu is saying by “not reversible” is that you have shown “If $a, b$, and $c$ are integers such that $a+b+c=1000$ and $a^2+b^2=c^2$, then $2c=1000− (ab/500)$.” That is not the same thing as “If $a$ and $b$ are integers and $2c=1000−(ab/500)$, then $a+b+c=1000$ and $a^2+b^2=c^2$.”

2
On

One problem is the assumption that $\quad 5^2+200^2=795^2.\quad $ There are no "small" triples with side differences of two orders of magnitude. The $b$-value is good but the following solution provides the $a$-value to "fit" your logic and the $c$-value will be shown to match your "solution" in the last equations below.

If we assume that $a$ is odd and $b$ is even, then the rules are that $a$ is any odd number greater that $1,\space$ $b$ is a multiple of $4,\space$ and $c$ must be of the form $4n+1$. Experimentally, a spreadsheet can show that one solution is $(375,200,425).\quad$ Alternatively, the following works if only paper and a calculator are available.

We begin with Euclid's formula where $$ \qquad A=m^2-k^2\qquad B=2mk \qquad C=m^2+k^2\qquad$$

Since $a$ is every $2nd$ integer but $b$ is every $4th$, it is faster to try $b$-values using the following formula, where any integer solution yields a valid triple.

\begin{equation} B=2mk\implies k=\frac{B}{2m}\qquad\text{for}\qquad \bigg\lfloor \frac{1+\sqrt{2B+1}}{2}\bigg\rfloor \le m \le \frac{B}{2} \end{equation} The lower limit ensures $m>k$ and the upper limit ensures $m\ge 2$

$$B=200\implies\qquad \bigg\lfloor \frac{1+\sqrt{400+1}}{2}\bigg\rfloor =10 \le m \le \frac{200}{2}=100\\ \land \quad m\in\{20,25\}\implies k\in\{5,4\}$$ $$f(20,5)=(375,200,425)\qquad f(25,4)=(609,200,641)$$

We can see that $f(20,5)$ is the only solution where $a+b+c=1000.\quad$ This required testing only $11$ $m$-values for $b=200.$

If we try these "assumed" values in your equations we get $$2c=1000-\frac{ab}{500} =\frac{500,000-75000}{500} =850$$ $$c=425$$

If you require that $a<b<c$, use $(200,375,425).\quad$

1
On

$a = p^2 - q^2\\ b = 2pq\\ c = p^2 + q^2$

For any $(p,q:p>q), (a,b,c)$ will be a pythagorean tripple

$p^2 - q^2 + 2pq + p^2 + q^2 = 1000\\ 2p^2 + 2pq = 1000\\ p(q+p) = 500$

$p$ is a factor of $500$

If $p$ is too small, $q$ is too big, and $p^2 - q^2 < 0$

And $p$ is too big, $q< 0$

$\sqrt{250}<p<\sqrt{500}$

$p = 20,$ works

Our triple is $(375,200,425)$ but we need to reorder to meet one of the criteria.

6
On

Let us label the system $$\begin{align*} a^2 +b^2 &= c^2 \\ a+ b + c &= 1000 \\ a &< b < c \end{align*}\tag{1}$$ and the equality you got: $$2c = 1000-\frac{ab}{500}.\tag{2}$$

What you proved is the following: "If $a,b,c$ are such that $(1)$ is true, then $(2)$ is true as well." Symbolically, you proved $(1)\implies (2).$

What you didn't prove is: "If $a,b,c$ are such that $(2)$ is true, then $(1)$ is true as well." We would symbolically write it as $(2)\implies (1)$. In fact, you proved that this is not true by finding a counterexample.

We would say that $(2)$ is a necessary condition for $(1)$, but it is not sufficient.

In general, when $P\implies Q$ is true and $P$ is true, you can (correctly) conclude that $Q$ must be true as well. This type of reasoning is called modus ponens. However, your error is that you have that $P\implies Q$ is true and then from assumption that $Q$ is true, you (incorrectly) concluded that $P$ is true. This is a logical fallacy called affirming the consequent.