Question 1036217
How can i write a rational function
<pre>
That means:

It must be a fractional equation with polynomial numrator and denominator:

{{{"f(x)"=POLYNOMIAL/POLYNOMIAL}}}

 with a horizontal asymptote at y=3, 

That means: 

1.  The degree of the numerator and denominator are the same, and
    The leading coefficient of the numerator is 3 times the leading
    coefficient of the denominator.
</pre>
...is never negative.
<pre>
That means the numerator and denominator must be the same even 
power of an expression.  We'll choose the smallest even power 2,
of the simplest forms which is linear form with leading coefficient
1 and multiply the numerator by 3 so that the leading coefficient
of the numerator will be 3 times the leading coefficient of the
denominator.  So it is of the form:

{{{"f(x)"=3(x+a)^2/(x+b)^2}}}
</pre>
...a vertical asymptote at x=2, 
<pre>
That means x-2 must be a factor of the denominator. So we make b=-2:

{{{"f(x)"=3(x+a)^2/(x-2)^2}}}
</pre>
...y-intercept at y=4,
<pre>
This means that it goes through (0,4), so we substitute
(x,y) = (0,4)

and since y = f(x) we set f(x)=4 and x=0:

{{{"f(x)"=3(x+a)^2/(x-2)^2}}}
{{{4=3(0+a)^2/(0-2)^2}}}
{{{4=3a^2/2^2)}}}
{{{4=3a^2/4}}}
{{{16=3a^2}}}
{{{16/3=a^2}}}
{{{sqrt(16/3)=a}}} <--take positive square root
{{{4/sqrt(3)=a}}}
{{{4sqrt(3)/3=a}}} <--after rationalizing denominator

Substitute for "a":

{{{"f(x)"=3(x+4sqrt(3)/3)^2/(x-2)^2}}}

That is a form of the equation.  We can simplify that:

{{{"f(x)"=3(x^2+expr(8sqrt(3)/3)x+16*3/9)/(x-2)^2}}}

{{{"f(x)"=3(x^2+expr(8sqrt(3)/3)x+16/3)/(x-2)^2}}}

{{{"f(x)"=(3x^2+8sqrt(3)x+16)/(x-2)^2}}}

Graph:

{{{drawing(800,800,-25,25,-10,50,
green(line(-100,3,100,3), line(2,-100,2,100)),
graph(800,800,-25,25,-10,50,3(x+(4sqrt(3)/3))^2/(x-2)^2))}}}

Edwin</pre>