Solution:
Key idea: A long straight wire carrying current I1 produces a field B=2πrμ0I1 at distance r.
A short wire of length l carrying current I parallel to it feels the force F=BIl. Currents in the same direction attract.
Step 1 — Find the field of X at P.
P is at distance r1 from X, so the field there is
B1=2πr1μ0I1
Y is short, so this field is the same all along Y, and it is perpendicular to Y.
Step 2 — Find the force of X on Y (part (i)).
The force on the length l of Y is
F1=B1Il
F1=2πr1μ0I1Il
Both currents flow upwards, so this force pulls Y towards X.
Step 3 — Find the force of Z on Y.
Z carries I2 upwards at distance r2 from Y, so in the same way it pulls Y towards Z with the force
F2=2πr2μ0I2Il
Step 4 — Use the condition for Y to stay at rest (part (ii)).
The two forces act in opposite directions, so Y stays at rest when they are equal in size.
2πr1μ0I1Il=2πr2μ0I2Il
r1I1=r2I2
I2I1=r2r1
Therefore, (i) X exerts a force 2πr1μ0I1Il on Y, towards X, and (ii) Y remains at rest when I2I1=r2r1.