Keep these three things in mind when dealing with recursions;
- Where it stops(what is the target)?
- That and back.(What is the condition, what is the definition of one loop)
- Divide and conquer
Solving recursive pieacewise function
Recursion problem can be divided and solved in the following method;
- Simplify→Simplify calculations until the base case is reached
- Substitute→ Substitute the base case in last expression
- Solve→Solve the remaining expression until the last one is solved.
Piecewise function is a mathematical recursion which occurs at problem like this;

It is a complex subject so I won’t explain it here, but you can find how to solve it by reading the following page: