Two gear wheels A and B are touching each other and they can rotate about fixed points P and Q respectively. how to calculate the degree of freedom of the system by using gubbler's equation?
The gear is just two otherwise independent items linked together. What you do is calculate the freedom as you would without the gear and then eliminate one from the other of the gearpairs to account for the gear forcing the other object. So if your gears can just rotate and have only one degree of fredom then the system of 2 gears has freedom of 1.
It is not generally a good idea to think this way unless you idealize the gear quite much. A real gear sytem does have backlash.