0
$\begingroup$

I am dynamically creating worksheets and I need to come up with some a, b and c values for a quadratic equation that will yield an integer x. How can I do this?

$\endgroup$
  • $\begingroup$ $\{a,b,c\}=\{1,0,-n^2\}$? or $\{a,b,c\}=\{1,-2n,n^2\}$ $\endgroup$ – lulu Aug 18 '16 at 13:52
  • $\begingroup$ In the second case a will always be 1. Can I somehow make that not the same always? $\endgroup$ – Shamoon Aug 18 '16 at 13:54
  • $\begingroup$ You can just multiply through by a constant. $\{m,-2mn,mn^2\}$ $\endgroup$ – lulu Aug 18 '16 at 13:56
  • $\begingroup$ First, pick $a$, $b$ and $x$. Now, $ax^2+bx+c=0$, so $c=-ax^2-bx$. $\endgroup$ – Mastrem Aug 18 '16 at 13:56
  • 4
    $\begingroup$ You could always expand the product $$ (a_1x - b_1)(a_2x - b_2) = \\ (a_1a_2) x^2 - (a_1b_2 + b_1a_2)x + b_1b_2 $$ it suffices to select integers $a_1,a_2,b_1,b_2$ (with $a_1,a_2$ non-zero). The solutions are $x = b_1/a_1, x = b_2/a_2$. $\endgroup$ – Omnomnomnom Aug 18 '16 at 13:59
5
$\begingroup$

The easiest way is to simply choose roots $r_1$, $r_2$ and second degree coefficient $\alpha\neq 0$ as integers, then expand the expression $$p(x) = \alpha (x-r_1)(x-r_2). $$

Example. Let $\alpha = 2$, $r_1 = -1$ and $r_2 = 3$, then we get

$$p(x) = 2(x-(-1))(x-3) = 2x^2 - 4x -6, $$ which has the requested integer roots $-1$ and $3$.

Coefficients. By expanding $p(x)$ in general you get that $$p(x) = Ax^2 + Bx + C$$ with \begin{align} A &= \alpha\\ B &= -\alpha(r_1 + r_2)\\ C &= \alpha r_1 r_2. \end{align}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.