I have the following function:
$$ f(x,y)=3xy^2+e^{xy} $$
I first calculated it in the normal way, using the unit vector, and the resulting value was $\sqrt2$.
Then, I tried calculating it by definition using $$ \lim_{t\to 0}\frac {f(2+t,0+t)-f(2,0)}{t} $$
and the result was infinite.
What am I doing wrong?
Your result $\sqrt2$ is the directional derivative to the unit vector $v = (\frac{1}{\sqrt2},\frac{1}{\sqrt2}) $ .
So, by definition, it goes: $$\lim_{h\to0}{\frac{f(2+\frac{h}{\sqrt2},\frac{h}{\sqrt2}) - f(2,0)}{h}}$$ $$=\lim_{h\to0}{\frac{f(2+h,h) - f(2,0)}{{\sqrt2}h}}$$ $$=\lim_{h\to0}{\frac{3(2+h)h^2 + e^{(2+h)h} - 1}{{\sqrt2}h}}$$ ($\frac{0}{0}$type, use L'Hôpital's rule) $$=\lim_{h\to0}{\frac{9h^2 + 12h + (2h+2)e^{(2+h)h}}{\sqrt2}}$$ $$=\frac{2}{\sqrt2}$$ $$=\sqrt2$$
So, there's no problem.