# Simplify expression

Unclear what do here, can't find a similar example online. I need to simplify down this expression.

$$g(q( (1-g)(1-f) ) ) - q( (1-g)(1-f) )^2$$

I understand you don't need to provide the answer for me. Just a similar example so I can work this one out alone would be sufficient

All g and f are numbers. q is also numbers e.g q=0.5

-
I take it, $f$ and $g$ are numbers? What about $P$ and $q$? They're written as functions. If so, you have to say what functions. Otherwise noting can be done. –  Karolis Juodelė May 2 '13 at 6:58
I think it's pretty simple as it stands, I don't see how you could improve this expression. There are maybe a few brackets too many, but that's all I can think of. –  Raskolnikov May 2 '13 at 9:53
@raskolnikov sorry there was an error in expression. Sorry thank for your comment –  Sorryjustdaft May 2 '13 at 10:39

You have a difference between two terms: $A-B$.

The second term $B$ is $q((1-g)(1-f))^2 = q(1-g)(1-f)(1-g)(1-f)$, so it is a product of 5 factors, among them $(1-f)$. So $B = (...)*(1-f)$.

Write the first term $A$ also as a product of factors, among them again $(1-f)$. $A = (.....)*(1-f)$.

Now apply distributivity: $(.....)*(1-f) - (...)*(1-f) = (.... - ...)*(1-f)$.

(Note that distributivity $ax-bx=(a-b)x$ works even if $x$ is a more complicated expression, such as $(1-f)$.)

Once you have done that, you will see how to simplify further.

-