Finding a function given a tangent to the curve I have got the following maths problem:

In the curve $y=x^2+ax+b$ where $a$ and $b$ are constant.
The tangent to the curve where $x=1$ is $2x+y=6$. Find the values of $a$ and $b$.

I am just unsure how I would go about answering this.

Since the involved function is just a quadratic function, you can try not to use any calculus.
The question can be translated as follows:
The equation $x^2+ax+b= 6-2x$ has a double root at $x=1$,
or even  $f(x)=x^2+(a+2)x+(b-6)$ can be factorized as $f(x)=k(x-1)^2$, by factor theorem.

Edit Seems my answer above lead to confusions. Just let me add a few words to elaborate:

The equation $x^2+ax+b= 6-2x$ has a double root at $x=1$.

This line is easy. For a quadratic curves, a tangent line can only intersect the quadratic curve at one and only one point. Thus, after solving $(E)$: $\begin{cases} y=x^2+ax+b \\ 2x+y=6 \end{cases}$, we can obtain one and only one solution. By making $y$ as the subject for the line equation, be obtain $y=6-2x$. Substitute this to another equation, $x^2+ax+b= 6-2x$ has a double (or repeated) real root at $x=1$.

$f(x)=x^2+(a+2)x+(b-6)$ can be factorized as $f(x)=k(x-1)^2$, by factor theorem.

From the first part, we obtain  $x^2+(a+2)x+(b-6)=0$ has only one root of multiplicity 2. Write $f(x)=x^2+(a+2)x+(b-6)$. By factor theorem, we can only write $f$ as multiple of $(x-1)^2$. Then $x^2+(a+2)x+(b-6) \equiv kx^2-2kx+k$.
Then we have $k=1, a=-4, b=7$.

No matter what method we used to find the values of $a$ and $b$, we just need to check that the above pair of value $a$ and $b$ is sufficient for $y=x^2+ax+b$ to have a tangent line $2x+y=6$.
Take $f(x)=x^2-4x+7$, $f'(x)=2x-4 \Longrightarrow f(1)=-2$. Then the slope of tangent line $= -2$. $f(1)=1-4+7=4$ The tangent line also passes through $(1,4)$. Then by point slope form, the equation of tangent line is $(-2)(x-1)=y-4 \iff 2x+y=6$.
