addition and multiplication functions from chapter 4