# Is it possible to use FindRoot with a function of two variables? [closed]

How can I use FindRoot with 2 variables function? Is there a different way to do that? For example

f[x_,y_]=Sin[x + y^2];
FindRoot[f[x,y], {x, -1}, {y, -3}]


## closed as off-topic by bbgodfrey, m_goldberg, garej, Daniel Lichtblau, Alex TrounevJun 24 at 3:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – bbgodfrey, m_goldberg, garej, Daniel Lichtblau, Alex Trounev
If this question can be reworded to fit the rules in the help center, please edit the question.

• FindRoot[{Cos[x + y], Sin[x y]}, {x, 2}, {y, 3}]? – AccidentalFourierTransform Jun 23 at 1:35
• @AccidentalFourierTransform I think HD2006 means functions that take 2 arguments f[x_, y_]. – Rohit Namjoshi Jun 23 at 2:01
• If you have 2 unknowns, you need 2 equations, as in @AccidentialFourierTransform's comment. – Carl Woll Jun 23 at 3:07

You cannot use FindRoot to find a root of

f[x_, y_] := Sin[x + y^2]


because a function of two variables like f doesn't have roots in the sense that a function of one variable has. When a function of two variables intersects the xy-plane, it normally produces contour lines not individual points. You can examine such contours with ContourPlot. Your function f, because of the oscillatory nature of Sin has several contours at f[x, y] == 0 in the vicinity of $$(-1,\,-3)$$ as can be seen from the following plot.

ContourPlot[f[x, y] == 0, {x, -2, 0}, {y, -4, -2},
Epilog -> {Red, AbsolutePointSize[5], Point[{-1, -3}]}]


• Assume that these Contours have a minima/maxima at specific points, is it possible to find them? For example, the ContourPlot of Sin[x^3 + y] - 2 Cos[x y] has a maximum around (-1.8,2.6) – HD2006 Jun 23 at 3:58
• @HD2006. That seems to be an entirely different question concerning the finding critical points of a function of two variables. You might look at FindMaximum. If that doesn't work for you, I suggest posting a new question. – m_goldberg Jun 23 at 4:17