12

Can the product of $A, B$ be computed using only $+, -,$ and reciprocal operators using a calculator? You can use calculator's memory function (multiply and divide are broken though).

Additional: I should have mentioned earlier, in addition to the 3 operators, the numberpad of the calculator can be used so yes 1 can be used.

Prateek
  • 293
  • 1
    Are $A$ and $B$ any real numbers? – J126 Mar 17 '12 at 22:39
  • 9
    What kind of objects are $A$ and $B$? Integers? Reals? Matrices? – Arturo Magidin Mar 17 '12 at 22:39
  • 1
    Sure. $A$ times $B$ equals $A$ plus $A$ plus $A$ plus ... etc. (a total of $B$ times). You will get very bored if $B$ is very large. – Jeff Mar 17 '12 at 22:40
  • @joe: A and B are integers – Prateek Mar 17 '12 at 23:04
  • @Prateek reciprocal is not well defined on integers (except for $\pm 1$). Inverse, however, is well defined on non-zero rational and real numbers. Since you mentioned calculators, I assume you really mean real numbers: $\mathbb{R}$. –  Mar 17 '12 at 23:10
  • @J.D>: You are right - A and B are real numbers. – Prateek Mar 17 '12 at 23:13
  • 1
    You accepted an answer that uses a constant $1$. If that was intentional, I think you should clarify the question to reflect that not only $A$ and $B$ but also constants can be entered. – joriki Mar 17 '12 at 23:22
  • Yes - I just edited the question to add that 1 could be used – Prateek Mar 17 '12 at 23:50
  • 1
    @Prateek: Ah, too bad, I just posted a proof that it's impossible without constants :-) – joriki Mar 17 '12 at 23:52
  • 3
    Of interest to some people: this question stirred up some deeper discussion: Reciprocal-based field axioms. –  Mar 18 '12 at 04:59
  • @Prateek Why is Jeff 's answer in the comment above not valid if both A and B are integers? Since you are allowed to use the memory of the calculator, you can keep track of how many times more you need to add A to itself (initially B times, then B-1, then B-2, etc. until 0). Why do we need those complicated reciprocal operations in the accepted answer? – user5054 Jan 14 '18 at 23:44

4 Answers4

21

Edit: previous answer was wrong. Posted new answer. Hopefully right this time

  1. We can compute and store $A^2$ using $$ \frac{1}{A} - \frac{1}{A+1} = \frac{1}{A^2 + A} $$ We can extract $A^2$ using only $+, -, ^{-1}.$ Similarly we can compute and store $B^2.$

  2. Then

$$\frac{1}{A+B-1} - \frac{1}{A+B} = \frac{1}{(A+B)(A+B-1)} = \frac{1}{A^2 + B^2 + 2AB - A - B} $$

where we can extract $2AB,$ again, using only $+, -, ^{-1}$ and the values for $A^2, B^2$ we computed in step $1$ above.

Thanks to joriki, now to get $AB$ from $2AB$, add $\frac{1}{2AB} + \frac{1}{2AB},$ and take the reciprocal.

  • 1
    You can extract $2AB$, not $AB$, but you can add $1/(2AB)$ to itself to get $1/(AB)$. By the way you've got two sign errors; the first equation has the difference the wrong way around, and in the end result it should be $+2AB$. – joriki Mar 17 '12 at 22:54
  • @joriki I changed the signs. Thanks for the 1/2 trick! –  Mar 17 '12 at 22:56
  • 3
    A little simpler: $\frac{1}{x-1}-\frac{1}{x+1}=\frac{2}{x^2-1}$. Then $\frac{(A+B)^2-1}{2}-\frac{A^2-1}{2}-\frac{B^2-1}{2}=AB+1$. – N. S. Mar 17 '12 at 22:59
  • 3
    To both J.D. and @N.S.: How do you get the $1$? – joriki Mar 17 '12 at 23:08
  • @joriki excellent question. I can't think of any scheme involving $A, B, +, -, ^{-1}$ that can get $1$ (or any other constant.) –  Mar 17 '12 at 23:22
  • There isn't one; see my answer. – joriki Mar 17 '12 at 23:52
  • 1
    I would also mention the case of $A=0$ or $B=0$ (and in the case both equal zero, none of the above is defined). – Asaf Karagila Apr 13 '12 at 13:14
  • @N.S. There is an error in your second equation, the RHS should be $(2AB+1)/2,$ not $AB+1$. Alas, it is less simple after correcting this. – Bill Dubuque Apr 13 '12 at 14:07
21

J.D. and N. S. have shown how to do it if a constant $1$ is allowed. Here's a proof that it can't be done if only $A$ and $B$ can be entered, no constants.

We can show by structural induction that all expressions we can generate change sign if both $A$ and $B$ change sign.

Base case: The two atomic expressions $A$ and $B$ change sign when both $A$ and $B$ change sign.

Induction step: $x+y$ changes sign when both $x$ and $y$ change sign, $x-y$ changes sign when both $x$ and $y$ change sign, and $x^{-1}$ changes sign when $x$ changes sign.

Since $AB$ doesn't change sign when both $A$ and $B$ change sign, it follows that it can't be generated from $A$ and $B$ using only these operations.

joriki
  • 238,052
  • That's only true if you can't find out what A or B is or if they are non-integers. Otherwise $\sum^{A} \frac{1}{A} = 1$. – Fax Dec 06 '19 at 10:57
  • 1
    @Fax: That's true. On the other hand, if you can perform $A$ additions dependent on $A$, with $A$ an integer, then you don't need a complicated detour through $1$; then you can just compute $AB=\sum^AB$. My answer only shows that the product can't be computed through some fixed set of operations. – joriki Dec 06 '19 at 11:14
  • 1
    Good point. Also, now that I think about it, I could loosen the restriction in my comment from integers to rationals by $A = \frac{x}{y} \implies (\sum^y A) = x$. – Fax Dec 06 '19 at 11:33
8

user2468's solution ends up requiring quite a lot of operations -- three reciprocals to get $A^2$, then the same to get $B^2$, then another three to get $A^2+B^2+2AB-A-B$. Then to get rid of that pesky factor of 2 you need another three reciprocals, for a total of 12 reciprocal operations (and 31 binary operations).

It's possible to do better by employing some tricks:

  • Instead of $(A+B)^2 - A^2 - B^2$, which involves three terms, use $(A+B)^2 - (A-B)^2$, which involves only two terms.
  • Instead of needing to divide by a constant near the end of the process, which involves a lot more reciprocals, identify where in the formula you actually introduced the constant, and scale your other constants to match.

Using those tricks, I was able to reduce this down to 6 reciprocal operations and 11 binary operations:

$$ \frac{1}{\frac{1}{A+B-2} - \frac{1}{A+B+2}}-\frac{1}{\frac{1}{A-B-2} - \frac{1}{A-B+2}} = AB $$

I suspect this is probably the most beautiful solution to this challenge.

onigame
  • 385
1

We have $$\frac{A^2}4=\frac1{\dfrac1{A}-\dfrac1{A+4}}-A\tag1$$ and $$AB=\frac14\,(A+B)^2-\frac14\,(A-B)^2\tag2.$$

Guy Fsone
  • 23,903