Step(1)Create circular wait of processes where each process in the set is waiting for other to complete. How this is done is, give each process exactly 1 less the maximum number of resource it demands.
Now every process in the set is holding and waiting and the circular wait is created. Deadlock!!
Step (2). Now give one extra resource, so that any one process is able to complete, hence circular wait is broken.!
so 3+1=4 resources required to never fall into a deadlock
and Maximum 3 resources can be there for the deadlock to happen.