Hi, do not use x^2 but instead, use x**2, in Ruby the ^ operator is a binary xor. See the operator list for Ruby...

Ruby Operators
Ruby Operators - Learn about various Ruby operators, including arithmetic, comparison, logical, and assignment operators, and how to use them effectively in your code.
(www.tutorialspoint.com)
Try this formula...
((x-y)**2)/20