Applying Algebra to an Array of Numbers