The names ```output1``` and ```output2``` aren't great. Maybe it would be useful to have a function ```sumOfSquares``` and a similar function for the product (although it's less clear what to call it)?