Trousers have two legs, and so they are called a pair. Note, 'a pair' is treated as a singular noun; it's a unit, and it's countable: one pair, two pairs, three pairs, and so on.
1. is correct; 2. is correct; 3. is incorrect. In addition, 4. is correct:
4. Your trouser is in the mud. (It means, Your trouser (leg) is in the mud; 'leg' has been omitted.) ;-)