This circuit shows the effect of parasitic inductances present in protoboards or pcb routes of practical circuits. By using a bypass capacitor near the high frequency switching device(microcontroller for example), the voltage peaks are greatly reduced. The higher the capacitance, the better, but real capacitors parasitic inductance increases with its size and capacitace which does not solve our problem. For this reason we place different capacitor sizes and types in parallel so that we "cover" all issues.
Curves by color:
Green = power supply.
Orange = non-bypassed switching device.
Bkue = bypassed switching device.