# How to replace $-x^{}\,y^*-y^{}\,x^*$ by $-(x^{}\,y^*+y^{}\,x^*)$?

Up to now, I have tried some codes like the following:

(*Abs[Sh]^2 Cos[ϕ]^2 Sin[ϕ]^2 +
Abs[Sv]^2 Cos[ϕ]^2 Sin[ϕ]^2 -
Sv Conjugate[Sh] Cos[ϕ]^2 Sin[ϕ]^2 -
Sh Conjugate[Sv] Cos[ϕ]^2 Sin[ϕ]^2*)

hvhv = hvhv /. {-x_ Conjugate[y_] (Cos[ϕ_])^2 (Sin[ϕ_])^2 -
y_ Conjugate[
x_] (Cos[ϕ_])^2 (Sin[ϕ_])^2 -> -(x Conjugate[y] +
y Conjugate[x]) (Cos[ϕ])^2 (Sin[ϕ])^2}

(*Abs[Sh]^2 Cos[ϕ]^2 Sin[ϕ]^2 +
Abs[Sv]^2 Cos[ϕ]^2 Sin[ϕ]^2 + (-Sv Conjugate[Sh] -
Sh Conjugate[Sv]) Cos[ϕ]^2 Sin[ϕ]^2*)

hvhv = hvhv /. {-x_ Conjugate[y_] -
y_ Conjugate[x_] -> -(x Conjugate[y] + y Conjugate[x])}

(*Abs[Sh]^2 Cos[ϕ]^2 Sin[ϕ]^2 +
Abs[Sv]^2 Cos[ϕ]^2 Sin[ϕ]^2 + (-Sv Conjugate[Sh] -
Sh Conjugate[Sv]) Cos[ϕ]^2 Sin[ϕ]^2*)


But as you see none of them seems to work. In order to find the reason, I used the way of The displayed form may substantially differ from the internal form and I found out that both of the expressions have the same internal form and so they can not be replaced by each other.

-(x Conjugate[y] + y Conjugate[x]) // FullForm
(*Plus[Times[-1,y,Conjugate[x]],Times[-1,x,Conjugate[y]]]*)

-x Conjugate[y] - y Conjugate[x] // FullForm
(*Plus[Times[-1,y,Conjugate[x]],Times[-1,x,Conjugate[y]]]*)


Now there are two questions:

1. The internal form of -(x Conjugate[y] + y Conjugate[x]) shoud be (*Times[-1,Plus[Times[y,Conjugate[x]],Times[x,Conjugate[y]]]]*) by why is it (*Plus[Times[-1,y,Conjugate[x]],Times[-1,x,Conjugate[y]]]*)?
2. Is there any way to replace $-x^{}\,y^*-y^{}\,x^*$ by $-(x^{}\,y^*+y^{}\,x^*)$?
• The internal form is what you think it is, however in your last codeblock it is immediately evaluated: HoldForm[-(x Conjugate[y] + y Conjugate[x])] // FullForm gives HoldForm[Times[-1, Plus[Times[x, Conjugate[y]], Times[y, Conjugate[x]]]]] Oct 22, 2015 at 9:06

This offers no proper explanation, but seems to work in your case. The replacement rule is

Abs[Sh]^2 Cos[ϕ]^2 Sin[ϕ]^2 + Abs[Sv]^2 Cos[ϕ]^2 Sin[ϕ]^2 +
(-Sv Conjugate[Sh] - Sh Conjugate[Sv]) Cos[ϕ]^2 Sin[ϕ]^2 /.
{z_ (-x_ Conjugate[y_] - y_ Conjugate[x_]) :> -z (x Conjugate[y] + y Conjugate[x])}

(* Abs[Sh]^2 Cos[ϕ]^2 Sin[ϕ]^2 +
Abs[Sv]^2 Cos[ϕ]^2 Sin[ϕ]^2 -
(Sv Conjugate[Sh] + Sh Conjugate[Sv]) Cos[ϕ]^2 Sin[ϕ]^2 *)


and puts the expression in the desired form. I guess, it's because

-(x Conjugate[y] + y Conjugate[x])
(* -y Conjugate[x] - x Conjugate[y] *)


whereas

-z (x Conjugate[y] + y Conjugate[x])
(* -z (x Conjugate[y] + y Conjugate[x]) *)

• No, I don't want to factorize all Cos Sins. I can do that simply by the collect function but I don't want. Oct 22, 2015 at 9:30