White Balancing of images

Can somebody please explain me the concept of red gain and blue gain in white balancing.
I want to white balance a image using red gain and blue gain.