# Contrast vs. Brightness question

As part of my homework I need to prove (or disprove) that changing the contrast and, then, changing the brightness is (or isn't) the same as changing the brightness and, then, changing the contrast.

Let's assume that we are using gray-scale.

• Brightness: the mean of the gray levels.
• Changing brightness: adding or decreasing a constant value from every pixel.
• Contrast: max - min of the gray-scale levels.
• Changing the contrast: stretching the gray levels around the mean.

I understand that you need to disprove it, but I don't know how to do it in a formal way.

Write down brightness and contrast as functions that act on a single gray-scale pixel. As you said, brightness is $b(x) = x + \alpha$ and contrast is $c(x) = \beta(x - x_\text{mean}) + x_\text{mean}$ or something similar. Now all you need to show is that $b \circ c \neq c \circ b$.