[Question]
  [
# Introduction
How to prove that 1 = 2:
```
1 = 2 
2 = 4 (*2)
-1 = 1 (-3)
1 = 1 (^2)
```
You can just multiply both sides by 0, but that's cheating. This is just bending the rules a little bit.
# Your challenge:
Write a program/function that, when given two integers, outputs a "proof" that the two are equal.
# Rules
* Your program's output must start with `a = b`, where a and b are the integers, and end with `c = c`, where c can be any number. Don't output the operations.
* Your output can only use integers.
* The only operations you can use are addition, multiplication, division, subtraction, and exponentiation, and you cannot multiply, divide or exponentiate by 0.
* Each line must be one of the above operations done to both sides of the equation in the previous line.
For example, you could go:
```
4 = 9
5 = 10 (+1)
1 = 2 (/5)
8 = 16 (*8)
-4 = 4 (-12)
16 = 16 (^2)
```
# Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest wins!
  
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~57~~ 54 bytes
```
a=>b=>a+`=${b}
${a+a}=${b+b}
${a-=b}=${-a}
${a*=a}=`+a
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/R1i7J1i5RO8FWpTqplkulOlE7sRbE1obwdG2TQFzdRDBPyxYomaCd@D85P684PydVLyc/XSNNw1BTw0hT8z8A "JavaScript (Node.js) – Try It Online")
## How?
There always exists a multiple of \$0.5\$ which, when subtracted from each number, creates a pair of the form \$-a = a\$. If \$a-x=c\$, then \$b-(a-x+b)=-c\$, so then if \$a-x+b=x\$, then \$x=\frac{(a+b)}2\$. This might not be an integer, so multiply by 2 beforehand.
-3 bytes thanks to Arnauld.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~13~~ 12 bytes
```
xIÂ-Dn)'=δý»
```
[Try it online!](https://tio.run/##yy9OTMpM/f@/wvNwk65Lnqa67bkth/ce2v3/f7SJjoJlLAA "05AB1E – Try It Online")
A port of my [Jelly answer](https://codegolf.stackexchange.com/a/226649/66833). I thought that 05AB1E's stack-based functionality would be shorter, but it isn't great at joining.
-1 byte thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs)!
```
xIÂ-Dn)'=δý» - Full program. Takes [a, b] on the stack
x            - Push [2a, 2b];   Stack = [[a, b], [2a, 2b]]
 I           - Push [a, b];     Stack = [[a, b], [2a, 2b], [a, b]]
  Â          - Bifurcate;       Stack = [[a, b], [2a, 2b], [a, b], [b, a]]
   -         - Subtract;        Stack = [[a, b], [2a, 2b], [a-b, b-a]]
    D        - Duplicate;       Stack = [[a, b], [2a, 2b], [a-b, b-a], [a-b, b-a]]
     n       - Square;          Stack = [[a, b], [2a, 2b], [a-b, b-a], [(a-b)², (b-a)²]]
      )      - Wrap into array; Stack = [[[a, b], [2a, 2b], [a-b, b-a], [(a-b)², (b-a)²]]]
       '=    - Push '='
         δý  - Join each with '='
           » - Join array by newlines
```
[Answer]
# [R](https://www.r-project.org/), ~~64~~ 51 bytes
-7 bytes thanks to Dominic van Essen.
```
cat(sep=c("=","
"),x<-scan(),2*x,y<-2*x-sum(x),y^2)
```
[Try it online!](https://tio.run/##K/r/PzmxRKM4tcA2WUPJVklHiUtJU6fCRrc4OTFPQ1PHSKtCp9JGF0jpFpfmalRo6lTGGWn@N1Gw/A8A "R – Try It Online")
The steps followed are:
```
a = b
2a = 2b (*2)
a-b = b-a (-(a+b))
(a-b)^2 = (b-a)^2 (^2)
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 bytes
```
,Ḥ;_U,²$Ɗj€”=Y
```
[Try it online!](https://tio.run/##ASYA2f9qZWxsef//LOG4pDtfVSzCsiTGimrigqzigJ09Wf///1s0LCA5XQ "Jelly – Try It Online")
Uses [ophact's observation](https://codegolf.stackexchange.com/a/226648/66833), that for any \$a, b\$, it is sufficient to yield the 4 equations
$$
a = b \\
2a = 2b \\
a-b = b-a \\
(a-b)^2 = (b-a)^2
$$
## How it works
```
,Ḥ;_U,²$Ɗj€”=Y - Main link. Takes [a, b] on the left
 Ḥ             - Double, yielding [2a, 2b]
,              - Pair; [[a, b], [2a, 2b]]
        Ɗ      - Previous three links as a monad f([a, b]):
    U          -   Reverse; [b, a]
   _           -   Subtract; [a-b, b-a]
       $       -   Previous two links as a monad f([a-b, b-a]]):
      ²        -     Square; [(a-b)², (b-a)²]
     ,         -     Pair; [[a-b, b-a], [(a-b)², (b-a)²]]
  ;            - Concatenate; [[a, b], [2a, 2b], [[a-b, b-a], [(a-b)², (b-a)²]]
         j€”=  - Join each with "="
             Y - Join with newlines
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~79~~ 78 bytes
```
for x in'input()','2*a,2*b','a-b>>1,b-a>>1','a*a,'*2:a,b=eval(x);print a,'=',b
```
[Try it online!](https://tio.run/##FYlBCoAgEEWv4m5UpoWzLPQuM1AkhIpY2OnNVv@998vbzpxojCNX1VVMEFO5mzaAQJaRrEziRUJwKAvP@X0@YGllFL8/fOlutlJjamp2DyhjOFT0AQ "Python 2 – Try It Online")
---
# [Python 3](https://docs.python.org/3/), 70 bytes
```
def f(a,b):x=a-b;return f'{a}={b}\n{2*a}={2*b}\n{x}={-x}\n{x*x}={x*x}'
```
[Try it online!](https://tio.run/##K6gsycjPM/7/PyU1TSFNI1EnSdOqwjZRN8m6KLWktChPIU29OrHWtjqpNiav2kgLxDTSAnMqgEzdCjBLC8QGker/C4oy80o00jQMdRSMNDX/AwA "Python 3 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~84~~ \$\cdots\$ ~~73~~ 71 bytes
Saved 5 bytes thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs)!!!  
Saved 2 bytes thanks to [dingledooper](https://codegolf.stackexchange.com/users/88546/dingledooper)!!!
```
k=a,b=input()
d=a-b
for a,b in k,[2*a,2*b],[d,-d],[d*d]*2:print a,'=',b
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9s2USfJNjOvoLREQ5MrxTZRN4krLb9IASiqkJmnkK0TbaSVqGOklRSrE52io5sCorRSYrWMrAqKMvNKgOrUbdV1kv7/N9QxAgA "Python 2 – Try It Online")
[Answer]
# [C (clang)](http://clang.llvm.org/), 65 bytes
```
#define r;printf("%d=%d\n",a
f(a,b){r,b)r+a,b+b)r-=b,-a)r*=a,a);}
```
[Try it online!](https://tio.run/##DYsxCsMwDAB3vyK4BKRGHlq6FOOfZFHiuBhaEZR0Cnm7o@XulpvD/GX5tHbLS6mydBpXrbIX8H1OfR7FE7sCTBMeatDBcjCHNFFg1HtiYoxns6v7cRVAd9jxoCdGt/73Dby3KvCit/lsFw "C (clang) – Try It Online")
Uses [ophact's approach](https://codegolf.stackexchange.com/a/226648/98541).
Using clang instead of gcc saves a byte, as clang handles the undefined behavior in the second `printf` differently than gcc:
```
printf("%d=%d\n",a-=b,-a);
```
The order of the arguments' evaluation is unspecified. In gcc, the `-a` is evaluated before `a-=b`; thus, the second argument is not affected by the subtraction and must be `b-a` to get the proper value. However, in clang, the `a-=b` is evaluated first so the second argument is affected by the subtraction so `-a` is the correct value.
---
# [C (gcc)](https://gcc.gnu.org/), ~~76~~ ~~74~~  66 bytes
*-8 bytes thanks to [tsh](https://codegolf.stackexchange.com/users/44718/tsh)*
```
#define r;printf("%d=%d\n",a
f(a,b){r,b)r+a,b+b)r-=b,b-a)r*=a,a);}
```
[Try it online!](https://tio.run/##DYsxDsMgDAB3XhFRRbIbMzTKUiF@ksVAqBiKIjedorydeLm75ZL7pNT7I2@ltm0Qv0ttRwE75jDmtVliU4Ap4ikKmTQntQuRomOUZ2Bi9FfXbfhybYDm1OVFM3qz/48fWKtVYKG3@uo3 "C (gcc) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
≔⁻⊗θΣθηＥ⟦θ⊗θηＸη²⟧⪫ι=
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DNzOvtFjDJb80KSc1RaNQU0chuDQXSAMZGZrWXAFFmXklGr6JBRrRhToKyMoydBQC8stTizSADCPNWB0Fr/zMPI1MHQUlWyVNTU3r//@jo010FCxjY//rluUAAA "Charcoal – Try It Online") Link is to verbose version of code. Takes input as a list `[a, b]`. Explanation: Based on @ophact's approach.
```
≔⁻⊗θΣθη
```
Vectorised subtract the sum of the list from its double, thus giving `[a-b, b-a]`.
```
Ｅ⟦θ⊗θηＸη²⟧⪫ι=
```
Loop over the lists `[a, b]`, `2[a, b]`, `[a-b, b-a]` and `[a-b, b-a]²`, joining each list with `=` and implicitly printing them on separate lines.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 50 bytes
Same as the javascript but using C#'s "superior code golfing" interpolation
```
a=>b=>a+@$"={b}
{a+a}={b+b}
{a-=b}={-a}
{a*=a}="+a
```
[Try it online!](https://tio.run/##Sy7WTS7O/O9Wmpdsk5lXoqOAYBWXFGXmpdvZKaQBhRRsFf4n2tol2dolajuoKNlWJ9VyVSdqJ9YCWdpgtq5tEpCjmwhia9kCJZS0E/9bcznn5xXn56TqhRdllqT6ZOalaoCM07DQ1DDV1LT@DwA "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal) `j`, 12 bytes
```
:d?Ḃ-:²Wƛ\=j
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=j&code=%3Ad%3F%E1%B8%82-%3A%C2%B2W%C6%9B%5C%3Dj&inputs=%5B6%2C%209%5D&header=&footer=)
Why write your own original answer when you can just port 05ab1e amiright? :p
## Explained
```
:d?Ḃ-:²Wƛ\=j
:d           # [a, b], [2a, 2b]
  ?Ḃ-        # [a - b], [b - a]
     :²      # that, but squared
       Wƛ\=j # join each on "=" and then join that on newlines with the j flag
```
[Answer]
# [Julia 1.0](http://julialang.org/), 48 bytes
port of [ophact's answer](https://codegolf.stackexchange.com/a/226648/98541)
```
a\b="$a=$b
$(2a)=$(2b)
$(a-=b)=$(-a)
$(a*=a)=$a"
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/PzEmyVZJJdFWJYlLRcMoUdMWSCZpAtmJurZJIJ5uIpinZQuSS1T6X1CUmVeSk6dhGGOkyQXjIFgmMZaa/wE "Julia 1.0 – Try It Online")
## alternative answer, 48 bytes too
output is a list of strings
```
a\b=join.([a=>b,2a=>2b,(a-=b)=>-a,a*a=>a*a],'=')
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/PzEmyTYrPzNPTyM60dYuSccISBol6Wgk6tomadra6SbqJGoBhYBErI66rbrmf8MYIwW9GjuFgqLMvJKcvP8A "Julia 1.0 – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3), 72 bytes
```
f=lambda a,b:f"{a}={b}\n{2*a}={2*b}\n{a-b}={b-a}\n{(a-b)**2}={(a-b)**2}"
```
Uses [ophact's observation](https://codegolf.stackexchange.com/a/226648/104415) to answer in 4 steps.
[Try it online!](https://tio.run/##K6gsycjPM/7/P802JzE3KSVRIVEnySpNqTqx1rY6qTYmr9pIC8Q00gJzEnWTQOK6iSCOBpCnqaVlBBSBM5X@/wcA)
[Answer]
# GolfScript, 37 bytes
```
~:%;:$' = ':&%n$2*&%2*n$%-&%$-.n\2?.&\
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/v85K1dpKRV3BVkHdSk01T0VFW01VVTtPRVVXTVVFVy8vxsheTy2G6/9/IwVTAA)
[Answer]
# [Desmos](https://www.desmos.com/), 207 characters
[Try it online!](https://www.desmos.com/calculator/crycwwosdl)
[Organized for readability](https://www.desmos.com/calculator/rovcaeqlyk)
Code:
```
<input 1>
<input 2>
<input 3>
a=ans_0
b=ans_1
c=ans_2
m=-(a+b)/2                           #Parenthesises placed here to show that addition occurs before addition; they don't appear in actual graph
d=-((a-m)^2-c)
l=[a,a+m,(a+m)^2,(a+m)^2+d]
l_1=[b,b+m,(b+m)^2,(b+m)^2+d]
(-1,[0,-1,-2,-3])
(0,[0,-1,-2,-3])
(1,[0,-1,-2,-3])
(4,0)
(4,-1)
(4,-2)
(4,-3)
                                    #LABELS (From higher to lower)
${l}
=
${l_1}
(given)
(${m})
(`^2`)
(${d})
```
Explanation:
`a` and `b` are the starting numbers, and `c` is the target number. Like my other programs, `ans_n` correspond to the line number, acting as inputs.
`m` is the midpoint of `a` and `b`. The reason that it is subtracted from `a` and `b` is so that they become equidistant from 0. NOTE: `m` is negative simply for formatting the proof; simply treat it as a positive and that all operations involving it are subtractions.
`d` is simply the distance between `c` and `(a-m)^2`. The squaring ensures that the term is positive, making both sides of the equation equal to each other. From there, the distance is added on to the result, making both sides of the equation equal to `c`.
`l` and `l_1` are lists. This is used to provide the labels. From left to right, the terms in the lists are as follows: the input, the input minus `m`, the square of (the input minus `m`), and the square of (the input minus `m`) plus `d`.
The first point, `(-1,[0,-1,-2,-3])`, uses `${l}` as a label. The list within the point creates multiple copies of the point at those y values, and the label uses the corresponding value from `l` to make it have the corresponding value on the graph. For example, `(-1,0)` would have `a` as its label. Likewise, the third point, `(1,[0,-1,-2,-3])`, would use `l_1` to produce its labels in a similar manner. The second point, however, would simply have the label be `=`.
Point `(4,0)` has the label `(given)`, which is self explanatory.
Point `(4,-1)` has the label `(${m})`, which uses `m` to produce the label of `(m)`.
Point `(4,-2)` has the label `(`^2`)`. The backticks are used to format the `^2` as a square and not as `^2`.
Point `(4,-3)` has the label `(${d})`, which uses `d` to produce the label of `(d)`.
]