Values for which a line is a tangent

The question is to "Find the values of k for which the line $y=3x$ is tangent to the cubic $y=x^3+k$". By differentiating (giving $\frac{dy}{dx}=3x^2$) I can work out that $\frac{dy}{dx}=3$ at 1 and -1... but I can't see how to work out values of k from this information. Any hints?

• Well, what are the equations of the tangent lines at these points? – amd Oct 3 '17 at 20:25

the slope of your function $$y=x^3+k$$ must be equal to the slope of the given Tangent line, this means $$3x^2=3$$
• The OP has already found the values of $x$ at which the slope is $3$. The question is about how to adjust the constant term of the cubic so that the tangent there passes through the origin. – amd Oct 3 '17 at 20:24
Use the fact that the tangent line touches the curve at 2 points, in this case, ($1,3$) and ($-1,-3$). Can you proceed now?