Capacitors are used in DC motors because of the following reasons:
To reduce interference and noise.
When a motor is running, frequent connection and interconnection happen between the brush and commutator, hence armature winding also connects and disconnects to the power supply frequency.
So motor current changes too fast, creating magnetic interference and noise in nearby radio devices.
So, to reduce this, a capacitor is connected across the motor terminals.
When a capacitor is connected, during frequent changes in motor load, the capacitor smoothens the rotation of the DC motor.
When changes occur in the motor frequently, the motor draws a frequently changing current from the power supply.
Here, the capacitor helps to keep the motor current and smoothen the motor speed.
The capacitor absorbs the back emf of the motor and keeps the power circuit healthy.
When the power supply is shut suddenly, the motor does not stop immediately, here motor acts as a generator and produces reverse voltage.
Here, the capacitors absorb back emf and keep the circuit healthy.
In a large motor, the capacitor is not enough, but in small Dc motors, the capacitor is used.