Let's begin by assuming these will be polynomial functions #f(x)# and #g(x)#.
Horizontal tangents to a graph come about when the slope at those points is 0, as all horizontal lines have a slope of 0. However, the slope is found by using the derivative #f'(x)#, meaning the derivative must be 0 at those three points. Furthermore, if a function has a value of 0 at a point #x=a#, we call that point a "zero of the function", or more precisely, we say that the factor #(x-a)# divides the function with no remainder.
This means we can say that the function #f'(x)# has three factors: #(x), (x-1), #and #(x-2)#. Thus:
#f'(x) = A(x)(x-1)(x-2)#, where #A# is some constant and #A!=0#. (Why? If #A=0#, then #f'(x)=0# and #f(x)# would be a horizontal line, but we were told these 3 #x# values are the only places with horizontal tangents.)
#f'(x) = A(x)(x-1)(x-2)#
#f'(x) = A(x^2-x)(x-2) = A(x^3-3x^2+2x)#
#:. f'(x) = Ax^3 - 3Ax^2 + 2Ax#
We integrate to get #f(x)#:
#f(x)=int f'(x) dx = A/4x^4-Ax^3+Ax^2+C#
(where #C# is any constant)
So, choose #A=4# and #C=1#. One answer could be:
#f(x)=x^4-4x^3+4x^2+1#
Choose #A = -4# and #C = -1#. The other answer could be:
#g(x)=-x^4+4x^3-4x^2-1#
graph{(x^4-4x^3+4x^2+1-y)(-x^4+4x^3-4x^2-1-y)=0 [-5.05, 7.44, -2.735, 3.51]}