# Simplifying Expression in Mathematica

How do I simplify this expression (a result i obtained from previous calculations)

Zin = (R1^2 + R1*RL + 2*L1*R1*s + L1*RL*s + L1^2*s^2 - M^2*s^2)/( R1 + RL + L1 s)


to

Zin = R1 + s*L1 - (s*M)^2/(R1 + RL + s*L1)


I've tried Apart, Cancel, Simplify, FullSimplify, and I can't figure out how to manipulate the equation to get it in the meaningful form I'm looking for.

### Edit

Proof they are identical (after correction) -thank you @bill s

Zin = (R1^2 + R1*RL + 2*L1*R1*s + L1*RL*s + L1^2*s^2 - M^2*s^2)/(R1 + RL + L1 s);

Z2 = R1 + s*L1 - (s*M)^2/(R1 + RL + s*L1);

FullSimplify[Zin == Z2]


True

• Have you considered the possibility that these expressions are not equal, or not equal for all possible complex values of parameters? Have you tried substituting in numbers to check this? – Szabolcs May 1 '17 at 21:16
• The two expressions you give are not equivalent. I suggest you check you previous calculations – mikado May 1 '17 at 21:17
• Sorry, my mistake ...they are meant to be identical. I messed up the sign infront of the (sM)^2 /(R1+RL+sL1) on the second equation when I transcrbed it from Mathematica to the forum. – jrive May 2 '17 at 17:16

The reason it won't simplify to that expression is because they are not equal. Here are your two expressions:

z1 = (R1^2 + R1*RL + 2*L1*R1*s + L1*RL*s + L1^2*s^2 - M^2*s^2)/(R1 + RL + L1 s);
z2 = R1 + s*L1 + (s*M)^2/(R1 + RL + s*L1)
FullSimplify[z1 == z2]
(M s)/(R1 + RL + L1 s) == 0


They are only equal if M s = 0!

• --No...my bad when copying the equations to the forum. Z2 should be R1+sL1-(sM)^2/(R1+RL+s*L1). The expressions are identical (should be, anyway, ;-)). I can't figure out how to get Mathematica to simplify the Z1 expression in your answer to the z2 expression. – jrive May 2 '17 at 17:23
Collect[Zin, (s*M)^2, Simplify]


$$\text{R1}+ \text{L1} s -\frac{M^2 s^2}{\text{R1}+\text{RL}+\text{L1} s}$$

• Simple! Thank you. – jrive May 3 '17 at 17:47