I would like to form common tangent equation for the functions f(x) and g(x) on the attachement. First of all I tried to form tangent equation for simple functions as y=x^2+2x+2 and y=-x^2-6x-14 but didn't manage. I am confused by now and any help would be appreciated.

Maybe it would be enough to show the way to get tangent equation for y=x^2+2x+2 and y=-x^2-6x-14 by explaining step by step (not only operations)

Thanks in advance.