Defense
You can defend against an opponent's attack with a weapon, unarmed or with a shield. If you are shooting, have no weapon or lose it, count unarmed defense.
Defense can be either active or passive. Usually the opponent has one attack, which you fend off with one defense, but he can take a risk and attack 2x.
You can defend with a base action, but thanks to feats you can learn to defend with a bonus action.
Active defense with a weapon or shield
Defense with a weapon is equal to the sum of weapon defense, half of dexterity and size:
weapon defense = Dex : 2 + weapon defense + Size + bonuses + 2d6
His defense with the sword is 8.
The GM rolls 3 and 2 on the dice for him, so his resulting defense roll is 13.
Active unarmed defense
Unarmed defense is equal to half of Dex.
You can use it at any time, even when you are holding a weapon or anything else.
unarmed defense =
Dex : 2 + Size + bonuses
Passive defense
If you have already used your active defense, you can defend for the rest of the round only passively, with a -5 penalty.
No special maneuver (luring the opponent, thief's defense) can be used as a passive defense.
More defensive actions
Thanks to some feats in fighting styles you can have more defenses (defensive actions). You can use them either to defend against several opponents, or to strengthen your standard defense with a maneuver (only against an active opponent).
Appendix
Minimum defense
If a character's defense after all modifiers and the roll is lower than 0, we count its defense as zero.
Character out of action
A character that is out of action or immobilized has defense 0 and does not roll.