# Simplifying using assumptions

Is there a way to simplify the following equation

 (-p(a-x)((a-b)P(b-x)+Q(b+x)(a-b+2x))+q(a+x)(-(a-b)Q(b+x)+P(b-x)(-a +b+2x)))/((b-x)(-a + x)(a+x)(b+x))


assuming

 {p+q == 1, P + Q == 1}


in order to get

q/(-a + x) - p/(a + x) - Q/(-b + x) + P/(b + x)


? Although FullSimplify works in this case when I am using instead of p,q,P,Q variables with subscripts according to the following substitution:

{p -> Subscript[A,1], q -> Subscript[B,1], P -> Subscript[A,2], Q -> Subscript[B,2],a-> Subscript[a,1],b-> Subscript[a,2]}


FullSimplify ceases to produce the desired result! This is pretty unexpected behaviour!

• FullSimplify with assumptions works here, but gives different result than You give. What do You mean by "Simplify with assumptions does not work"? You don't get any output, errors or what? Jan 11, 2014 at 21:27
• FullSimplify[(-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - x) (-a + x) (a + x) (b + x)), Assumptions -> {p + q == 1, P + Q == 1}] gives the correct answer, although as Wokciech said, it is a slightly different, but nevertheless equivalent expression. Jan 11, 2014 at 21:43
• @Wojciech: I formulated it wrong, it works, but does not produce a desired result ! Jan 11, 2014 at 22:19
• @yarchik If it doesn't produce a desired result, then what does it produce? When I type FullSimplify[(-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - x) (-a + x) (a + x) (b + x)), {p + q == 1, P + Q == 1}] /. {p -> Subscript[A, 1], q -> Subscript[B, 1], P -> Subscript[A, 2], Q -> Subscript[B, 2]} I get the same result I would get without ReplaceAll, of course with p,q,P,Q instead of A1,A2,B1,B2. Jan 11, 2014 at 22:37
• By the way, the result I get is 1/(b + x) + (-1 + B1)/( a + x) +B1/(-a + x) + (2 x B2)/(b^2 - x^2) Jan 11, 2014 at 22:41

Try this one

f1 = (-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) +
q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b -
x) (-a + x) (a + x) (b + x));


We define a substitution rule

rule = {(p + q) -> 1, (P + Q) -> 1};


which in combination with FullSimplify

f2 = FullSimplify[f1] /. rule


gives a slightly modified result from that you want which however, is equivalent.

Q/(b - x) + q/(-a + x) - p/(a + x) + P/(b + x)

• First of all thanks a lot for the prompt answer! It is funny, but I am still not completely satisfied. I my calculations I am using another symbols for constants. They are different from those that appear in this question. Let us try to reproduce this scenario: f4=f1/.{p -> Subscript[A, 1], q -> Subscript[B, 1], P -> Subscript[A, 2], Q -> Subscript[B, 2]}, and the same for the rule: rule2={Subscript[A, 1] + Subscript[B, 1] -> 1, Subscript[A, 2] + Subscript[B, 2] -> 1}. I am wondering why in this case your method does not work! Jan 11, 2014 at 22:14