How to minimize a function using vectors as input?

I'm learning Mathematica and meet a problem. Here is a simple example.

x = {0, 0.5, 1}
y = {a-3,b,10}
yl= {b,a,5}


I want to find the value of a and b when it minimum of (y-x)^2+(yl-x)^2

Nminimize[(y - x)^2 + (yl - x)^2, {a,b}]


But it returns

Minimize[{(-3. + a)^2 + (0. + b)^2, (-0.5 + a)^2 + (-0.5 + b)^2, 97.}, {a, b}]


What's the right way to solve this problem? Thanks

• I don't think I understand this at all. When a is 1, y1 - y is zero right? – Abhay Hegde Apr 9 at 18:11
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, [by clicking the checkmark sign](tinyurl.com/4srwe26 – Dunlop Apr 9 at 18:48
• Can you give a minimal example of what you are trying to do? This is not clear enough for people to help you. – Dunlop Apr 9 at 18:49
• Also note that NMinimize is case sensitive and you are showing Nminimize. – Tim Laska Apr 9 at 18:53
• I rewrite the example, I think it is clear now, thank you guys – YzWu Apr 9 at 18:59

You have a typo in NMinimize and it will require the objective function to be a scalar and not a vector. You could minimize the Norm of the vector like so.
x = {0, 0.5, 1};