You defend with your rook against rook and knight pawn. The rook on d1 cuts your king off two files from the b-pawn, and with a knight pawn that is not enough for White to win. His king on a4 wants to walk up beside the pawn. The rule: keep your rook far up the board, in front of the pawn, and check his king on the file where it stands. Ra8+ when it is on the a-file, Rb8+ when it is on the b-file.