If you are working with batteries as power supply you might have encountered the problem of reverse polarity. There are lots of different solutions, one more complicated than the other. But I will present you two effective yet simple ones.
Solution 1: Diode in the High-Side path
I don’t think I need a schematic for this one. You just take a diode and put it in the high-side path of the circuit. If you reverse the polarity the diode will block this off and you’re done. This is the real low-budget method, but not really a good one. Diodes always have a voltage drop of at least 0.7V (for Silicon diodes, 0.3V for Schottky). Depending on your current you have to use quite large diodes in order to dissipate the power. And if you are working with Li-Ion batteries with a typical voltage ov 4.2V-4.7V you already lost about a fith of your voltage right there. So this is not really the best way, but it is a cheap and effective way.
Solution 2: P-MOSFET
This is more interesting. The P-MOSFET will handle the whole reversing event like a pro.
In normal operation mode the MOSFET is turned on and passing everything through to the load. The Z-diode is taking care of keeping the transistor turned on.
If you now reverse the polarity, the gate is more positive than the source and the P-MOSFET is turnig off. Nothing will pass now. The Z-diode is now protecting the gate from becoming too positive and destroying the transistor. So the FET fully protects you from reverse polarity an will not produce a significant voltage drop.