We'll generalize the situation. Imagine that you want a quadratic equation that has the roots a and b. Then, your equation will be in the form: [tex]A(x-a)(x-b)=0[/tex], where [tex]A\neq0[/tex] is a constant.
Notice that if x=a or x=b the equation is true. To simplify, we'll choose A=1. In that problem, a=5 and b=-2. Hence:
[tex]1(x-5)(x-(-2))=0\iff (x-5)(x+2)=0\iff\\\\x^2-3x-10=0[/tex]