I am building a quadcopter for my school project. I am trying to program my own flight controller using PID algorithm.

I'll try to make my question simple using as an example below only two motors

                       1-----------2


Let's say I am trying to stabilize my two motor system using gyro from the diagram below to one above

                       1--
-----
----2


Using the formula Output = (gyro - 0) * Pgain

Do I need to increase the output only on the motor 2 or would I have to do both: increase the output on the 2nd motor while decreasing the output on the first motor? Thank you

Technically, you can do it either way, but consider the following scenario: You are flying with a heavy load, and there is a wind gust. Each rotor is operating at almost 100% capacity due to the heavy load. Now the wind gust has gotten you un-level. Say you need 20% of full speed to make the correction. What happens?

Well, if you are trying to control level only by increasing motor 2, then it's already essentially at full speed, so it cannot go any faster. The craft never levels because there is no "overhead" available - the actuator (fan) is operating at 100% so there is nothing left over for it to do when you ask for more.

If you try to control by splitting the 20% between motor 1 and motor 2, then motor 2 still can't do anything, but motor 1 can lower its speed by 10%. The vehicle will now level. Not as fast as if you weren't operating at near-capacity, again because the lack of overhead hinders performance, but it still responds.

This is typically how the quadrotor would be programmed. Each motor contributes to 1/4 of the thrust requested for altitude control, and then the attitude controller adds or removes from each motor in pairs.