The formula for the cube trick is (a + b)³ = a³ + 3a²b + 3ab² + b³, which is known as the binomial cube formula. It allows you to expand the cube of a binomial expression.