The general term of the expansion (x4−x31)15 is:
Tr+1=(r15)(x4)15−r(−x31)r=(r15)(−1)rx4(15−r)−3r=(r15)(−1)rx60−7r
For the coefficient of x18:
60−7r=18⟹7r=42⟹r=6
The coefficient is:
(615)(−1)6=(615)=6!⋅9!15!=5005
The coefficient of x18 is 5005.