0

Lets pretend i have some function $f(x) = 2*x_1 + 3*x_2$, and says find first order approximation around some point [a b].

I know the formula $f_a (x) = f(x') + f(x)'*(x-x')$, but do not know how to plug in 2 dimensional point in place of x'

By the way x' is a x hat, i do not know how to write here x hat :) And $f_a ()$ is affine


ASROMA
  • 579
  • If $x_1$ and $x_2$ are different variables, then our expression is its own linear approximation. If you had something like $x_1^2+3x_1x_2+x_3^3$, you would use partial derivatives, essentially find the tangent plane. – André Nicolas Oct 08 '12 at 05:45
  • ok, but how should i plug things into that formula, what would be the answer in the above case? – ASROMA Oct 08 '12 at 05:49
  • The $f(x)'$ should be $f(x')'$. (Unfortunate choice of alternative point, $x'$.) – copper.hat Oct 08 '12 at 05:50
  • @VaheMusinyan: If $x=(x_1,x_2)$, you get the linear approximation $2x_1+3x_2$. Or, equivalently, $2(x_1-a)+3(x_2-b)+ 2a+3b$. – André Nicolas Oct 08 '12 at 05:55

3 Answers3

2

This does not answer the main question, since that takes no work at all. So we deal with the $f(x_1,x_2)=e^{x_1+x_2}+x_1^2+x_2^3$ of a comment by the OP, in a neighbourhood of $(0,1)$. We have $$\frac{\partial f}{\partial x_1}=e^{x_1+x_2}+2x_1.$$ At $(0,1)$ this is $e$. Similarly, $$\frac{\partial f}{\partial x_2}=e^{x_1+x_2}+3x_2^2.$$ At $(0,1)$ this is $e+3$. So the linear approximation is $$(x_1-0)(e)+(x_2-1)(e+3)+ (e+1).$$ The last term $e+1$ is just $f(0,1)$.

We can simplify the above expression a little.

André Nicolas
  • 507,029
  • so my answer above is correct. hah ;) thanks – ASROMA Oct 08 '12 at 07:03
  • It depends on what your answer is. The only answer that I see below in a comment is $e^{x_1+x_2}+ 3x_2-2$, which is not right. The answer, simplified, is $ex_1+(e+3)x_2-2$. – André Nicolas Oct 08 '12 at 07:13
1

In this case $f'(x) = \begin{bmatrix} 2 & 3 \end{bmatrix} $.

The first order approximation (which is the function, since it is linear) is given by:

$$f_a(x) = f(x') + f'(x')(x-x') = 2x_1'+3x_2'+ \begin{bmatrix} 2 & 3 \end{bmatrix}\begin{bmatrix} x_1-x_1' \\ x_2-x_2' \end{bmatrix} = 2x_2+3x_2$$

copper.hat
  • 172,524
  • can you give the answer for this example, i cannot get the correct answer

    e^$(x_1 + x_2) +x_1^2 + x_2^3$ around [0 1]?

    – ASROMA Oct 08 '12 at 06:16
  • can you give me an answer for the case e^$(x_1+x_2)+x_1^2+x_2^3$ around [0 1]? – ASROMA Oct 08 '12 at 06:34
0

You will have to use a generalized formula. You can look this up here http://en.wikipedia.org/wiki/Taylor_series#Taylor_series_in_several_variables .

The idea is that you ask your function: "How do you change from this point (a,b) if I change this one variable while holding the other fixed?" for both variables and simply add the two contributions where the rates of change, which are nothing but the partial derivatives, are multiplied by the values of change, e.g. $x_1 -a$ etc. This correction turns out to be the directional derivative of the function at $(a,b)$ in direction of your change vector: $f_1 (\vec{x}) = f(\vec{x}_0) + (\vec{x}-\vec{x}_0) \cdot \vec{\nabla} f \vert_{\vec{x}_0}$. Try this out for your function - it is a special one, it is already quite linear!

  • can you give the answer for this example, i cannot get the correct answer e^$(x_1+x_2)+x_1^2+x_2^3$ around [0 1]? – ASROMA Oct 08 '12 at 06:18
  • $\vec{\nabla} f$ is a vector with the partial derivatives of $f$ and is called the gradient. The directional derivative at a point has another defintion (using a curve in time that passes through the point with the right velocity, then taking the time derivative). It can be shown with the chain rule that this geometric thing is indeed the expression above, the scalar product of the gradient and a vector of displacement. But you do not need all this to solve the problem. I just gave you two ways for visualization ;) edit: the calculation for this problem is the answer above, $f' = \nabla f$ – Andreas Finke Oct 08 '12 at 06:20
  • if the correct answer really involves the exponential function please check that you have typed in the example correctly – Andreas Finke Oct 08 '12 at 06:24
  • can you show me the solution by using fa(x)=f(x′)+f′(x')∗(x−x′) formula PLEASE?

    i am getting e(x1+x2) + 3*x2 - 2 what is wrong?

    – ASROMA Oct 08 '12 at 06:25
  • ah, this is another example. Well I think you are right with your solution! – Andreas Finke Oct 08 '12 at 07:43