A more mathematical definition for the rule of sum is pictured below,