# simplify and find equivalent from in mathematica

I have a very complicated polynomial expression ($R$) that I want to derive the necessary and sufficient condition for this expression to be positive. I wonder if Mathematica have simplification function to reduce my $R>0$ to some simpler but equivalent $R'>0$?

My expression is the following:

\begin{equation} R=[\pi^1_H(1-\delta P^1_{LL})+\delta\pi^1_LP^1_{HL}][1+\delta-\delta(P^3_{HH}+P^3_{LL})]-[\pi^3_H(1-\delta P^3_{LL})+\delta\pi^3_LP^3_{HL}][1+\delta-\delta(P^1_{HH}+P^1_{LL})], \end{equation} where $\delta\in(0,1)$ is a constant and all the other letters are defined as the following:

$\pi^1_H=[p_0v_H+(1-p_0)v_L]p_H$, $\pi^3_H=p_0v_Lp_H$,

$\pi^1_L=[p_0v_H+(1-p_0)v_L]p_L$, $\pi^3_L=\pi^1_L$,

$P^1_{LL}=1-p_L+p_L[p_0(p_{33}+p_{43})+(1-p_0)(p_{34}+p_{44})]$, $P^3_{LL}=P^1_{LL}$,

$P^1_{HH}=1-p_H+p_H[p_0(p_{11}+p_{21})+(1-p_0)(p_{12}+p_{22})]$,

$P^3_{HH}=1-p_0+p_0[1-p_H+p_H(p_{11}+p_{21})]$,

$P^1_{HL}=p_H[p_0(p_{31}+p_{41})+(1-p_0)(p_{32}+p_{42})]$,

$P^3_{HL}=p_0p_H(p_{31}+p_{41})$,

$p_0\in(0,1)$, $v_H>v_L>0$, $1>p_H>p_L>0$ $p_{ij}$ coming from a $4\times 4$ matrix $A$ (with all non-negative entries) such that each column of matrix $A$ add up to one, e.g., $p_{11}+p_{21}+p_{31}+p_{41}=1$.

First, I don't even know how to input this expression R with so many terms (which are again expressions) into mathematica, must I plug in all those sub expression into R and then type a huge expression into mathematica?

Can Mathematica reduce $R>0$ to some simplified but equivalent version of $R'>0$?

I have about 30 expressions of similar kind, so it would be great that the equivalent form $R'>0$ could be find by Mathematica

I used the function "Simplify" but the output does not seems to simplify too much...

pi1H = (p0*vH + (1 - p0)*vL)*pH;

pi3H = p0*vL*pH;

pi1L = (p0*vH + (1 - p0)*vL)*pL;

pi3L = pi1L;

P1LL = 1 - pL + pL*(p0*(p33 + p43) + (1 - p0)*(p34 + p44));

P3LL = P1LL;

P1HH = 1 - pH + pH*(p0*(p11 + p21) + (1 - p0)*(p12 + p22));

P3HH = 1 - p0 + p0*(1 - pH + pH*(p11 + p21));

P1HL = pH*(p0*(p31 + p41) + (1 - p0)*(p32 + p42));

P3HL = p0*pH*(p31 + p41);

Simplify[(pi1H*(1 - d*P1LL) + d*pi1L*P1HL)*(1 + d -
d*(P3HH + P3LL)) - (pi3H*(1 - d*P3LL) + d*pi3L*P3HL)*(1 + d -
d*(P1HH + P1LL))]


The output looks like

pH (1 + d (-1 + (1 + p32 - p34 + p42 - p44 +
p0 (p31 - p32 - p33 + p34 + p41 - p42 - p43 +
p44)) pL)) (1 + d -
d (2 + (-1 + p34 + p44) pL +
p0 ((-1 + p11 + p21) pH + (p33 - p34 + p43 -
p44) pL))) (p0 (vH - vL) + vL) -
p0 pH (1 + d -
d (2 + (-1 + p12 + p0 (p11 - p12 + p21 - p22) + p22) pH + (-1 +
p34 + p0 (p33 - p34 + p43 - p44) + p44) pL)) ((1 -
d (1 + (-1 + p34 + p0 (p33 - p34 + p43 - p44) + p44) pL)) vL +
d (p31 + p41) pL (p0 (vH - vL) + vL))

• "First, I don't even know how to input this expression R with so many terms" <- I don't understand. You typed it here in LaTeX. Why can't you type it in Mathematica? – Szabolcs Sep 14 '16 at 14:24
• @Szabolcs I mean I wonder if we must plug in ALL terms in to the expression $R$ and then insert it into Mathematica or if we could do something similar like here, first define a series of sub terms and then define the expression $R$. If it cannot be done, then I have no choice but to type the long expression. I am actually type the long expression into Mathematica right now and see if someone, for example, you, could tell me "there's a better way of doing that", I really appreciate it – KevinKim Sep 14 '16 at 14:29
• Well, you can a = b+c; d = a*(b+a), not? – Szabolcs Sep 14 '16 at 15:06
• @Szabolcs follow your advice thx, I update the OP. Mathematica does recognize this complicate expression, but it seems that the command "Simplify" does not simplify much. Is there any way to improve that? – KevinKim Sep 14 '16 at 15:20