4

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.

scribe
  • 524
  • 1
    Note: assuming this is the question you are working on, then of course it specifies positivity (as $a,b,c$ are said to be natural numbers). Also: please edit your post to include the link to Project Euler. Personally, I'm not clear whether we here are meant to be solving those problems or not. – lulu Jul 06 '21 at 15:16
  • 1
    See this discussion regarding Project Euler questions. I would say that those questions should be out of bounds on this site. – lulu Jul 06 '21 at 15:22
  • 1
    I’m voting to close this question because this is a Project Euler question, https://projecteuler.net/problem=9. – lulu Jul 06 '21 at 15:51
  • 1
    Comments are not for extended discussion; this conversation has been moved to chat. – Pedro Jul 07 '21 at 15:09
  • 1
    @Pedro, the comments made it clear that since this is a Project Euler problem solutions of the problem shouldn't be posted here. Since you moved the comments, three solutions have been posted. I think it was a bad idea to move those comments. – Gerry Myerson Jul 08 '21 at 03:08
  • 1
    @Gerry I've restored the relevant comments. Best, – Pedro Jul 08 '21 at 06:39

4 Answers4

3

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$.”

scribe
  • 524
1

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.

Ennar
  • 23,082
  • OP didn't ask for a solution to the problem, only for an explanation of why his/her approach failed (which you gave, but then you went on to solve the problem). – Gerry Myerson Jul 08 '21 at 03:10
  • Ah yes, the classical fallacy of the converse (hides a bachelors of maths in the back). Exactly which first step of mine is not $\iff$ compliant? – scribe Jul 08 '21 at 08:39
  • @scribe "since $a^2+b^2 = c^2$" line. Note that neither the 3rd line implies the 4th, nor the 4th implies the 3rd without assuming that $a^2+b^2 = c^2$. In terms of my labels, $(2)$ doesn't imply $(1)$, but $(2)$ and $a^2+b^2 = c^2$ does. – Ennar Jul 08 '21 at 09:03
  • 1
    @Gerry Myerson, please explain why is that a problem? If I understand correctly, Project Euler is not an ongoing competition, but a self-learning platform. One can choose for themselves whether they want to read a solution or not. Just like you might include solutions at the back of the book, it is up to the reader what to do with it. On the other hand, in the deleted comments it was suggested to OP that their approach is likely not a fruitful one and to do something else. This is what motivated me for writing this solution, since it uses OP's idea in what I think is a neat solution. – Ennar Jul 08 '21 at 09:18
  • I made no reference to Project Euler in my comment on your answer – but since you brought it up, the Project Euler people have asked us not to permit their questions to be discussed here, and as members of the greater mathematical community we respect their wishes. Project Euler or not, OP only asked where he/she had gone wrong, presumably wishing the enjoyment of then finding the right way him/herself. You have denied OP this enjoyment. – Gerry Myerson Jul 08 '21 at 12:45
  • 2
    @Gerry Myerson, as I said, I believe it is the responsibility of the reader what to do with typed solution. I announced clearly that a solution to the problem is coming. Anyone that continued reading after that point rid themselves of enjoyment, not me. OP is an adult, why treat them as a child? That said, I will remove the solution to the problem as a courtesy to Project Euler, even though I do not agree with the philosophy that one should actively remove a possible source that could "lead astray". If someone wants to do things their way, even when you advise differently, let them. – Ennar Jul 08 '21 at 12:59
0

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$

poetasis
  • 6,338
  • OP didn't ask for a solution to the problem, only for an explanation of why his/her approach failed. – Gerry Myerson Jul 08 '21 at 03:10
  • @Gerry Myerson I showed why the OP logic did not work in the first sentence.

    The solution was only to show how his logic did work, given the right assumption(s), The last equations show this.

    – poetasis Jul 08 '21 at 18:47
0

$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.

Doug M
  • 57,877