assignment solution

after writing required formula for the 2 functions