Let the total work required to complete the operation = x units of work

Computer Atakes 4 hours to complete x. The rate it runs the operation is x/4 units of work per hour.

Computer Btakes 2 hours to complete x. The rate it runs the operation is x/2 units of work per hour.

You are trying to find the time (lets call it 't') it takes for both of them working together to complete x.

So their combined rate of work x t = combined work done.

Now you can solve for t. The x variable cancels out.