Adjustments : Channel Mixer
Channel Mixer
Channel Mixer adjustment does exactly does what its name implies; it mixes color channels. You can use it to repair bad channels, create special effects, tint images, simulate color conversions and even produce grayscale images from color images based on a custom algorithm. You can also use it to swap or duplicate channels. The user interface is laid out like a 5-by-4 matrix showing how the input channels are summed to creates the output. Each takes a multiplier with denotes that contribution of that channel to the final output, with 1 representing 100% contribution. When you select any specific value, a slider is shown at the bottom via which you may easily manipulate that value.

The Math
As mentioned before, the filter is controlled through a 5-by-4 matrix. This is applied as follows:
| red | = a[ 0] * srcR + a[ 1] * srcG + a[ 2] * srcB + a[ 3] * srcA + a[ 4] |
| green | = a[ 5] * srcR + a[ 6] * srcG + a[ 7] * srcB + a[ 8] * srcA + a[ 9] |
| blue | = a[10] * srcR + a[11] * srcG + a[12] * srcB + a[13] * srcA + a[14] |
| alpha | = a[15] * srcR + a[16] * srcG + a[17] * srcB + a[18] * srcA + a[19] |
As you can see, the values in the first row determine the resulting red value, the second row the green value, the third row the blue value, and the fourth row the alpha value. You can also see that the values in the first four columns are multiplied with the source red, green, blue, and alpha values, respectively; while the fifth column value (offset) is added as is.