Q. If f(1)=1 and f(n)=f(n−1)−1 then find the value of f(5).Answer:
Base Case Given: We are given that f(1)=1. This is our base case.
Recursive Formula: We are also given a recursive formula: f(n)=f(n−1)−1. This means that to find f(n), we subtract 1 from the value of f at the previous integer, which is f(n−1).
Finding f(5): To find f(5), we need to find the values of f(4), f(3), f(2), and we already know f(1).
Calculating f(2): Using the recursive formula, f(2)=f(1)−1. Since f(1)=1, we have f(2)=1−1=0.
Calculating f(3): Next, f(3)=f(2)−1. We found that f(2)=0, so f(3)=0−1=−1.
Calculating f(4): Then, f(4)=f(3)−1. We found that f(3)=−1, so f(4)=−1−1=−2.
Calculating f(5): Finally, f(5)=f(4)−1. We found that f(4)=−2, so f(5)=−2−1=−3.