# How can i 2d-plot Cobb-Douglas function?

can I plot Cobb-Douglas function in 2D without using ContourPlot?

I have this function:

u[x1_, x2_] := Log[x1] + 2*Log[x2];


and now I plot it using:

ContourPlot[u[x1,x2], {x1, 0, 10}, {x2, 0, 10}]


how can i 2d-plot it using simple Plot?

• ...Plot[] is intended for functions of one variable. You have two variables in your function, so you'll have to set one of those two to a constant. – J. M. will be back soon May 6 '16 at 12:49
• I wrote a function to get a numerical solution for an implicit curve here, which can be useful in cases where the equations cannot be solved symbolically. Here they can be, but I'm curious why not use ContourPlot? It can be combined with other graphics, and it does a pretty good job on this function. I don't see the point, unless it's a homework exercise. – Michael E2 May 6 '16 at 13:49

u[x1_, x2_] = Log[x1] + 2*Log[x2];

cp = ContourPlot[u[x1, x2], {x1, 0, 10}, {x2, 0, 10}, PlotPoints -> 100]


Solve for x2 along the contours

f[x1_, c_] = x2 /. Solve[c == u[x1, x2], x2, Reals][[1]]

(*  E^(c/2)/Sqrt[x1]  *)


Plot the contours

plt = Plot[
Evaluate[
Table[
Tooltip[f[x1, c], c],
{c, -2, 6, 2}]],
{x1, 0, 10},
PlotRange -> {0, 10},
Frame -> True,
AspectRatio -> 1,
PlotStyle -> Thick,
ImageSize -> 360]


Overlaying the plots

Show[cp, plt]


EDIT: For a specific {x1, x2} then the contour is just u[x1, x2]

Manipulate[
Module[{c = u[x1, x2]},
Plot[Tooltip[f[x, c], c], {x, 0, 10},
PlotRange -> {0, 10},
Frame -> True,
FrameLabel -> (Style[TraditionalForm[#], Bold, 14] & /@
{Subscript[x,
1], Subscript[x, 2]}),
AspectRatio -> 1,
Epilog -> {Red, AbsolutePointSize[4], Point[{x1, x2}]}]],
{{x1, 5., Subscript[x, 1]}, 0, 10, Appearance -> "Labeled"},
{{x2, 5., Subscript[x, 2]}, 0, 10,
Appearance -> "Labeled"}]


• Thank you,but I have another doubt: how can I draw only one curve that pass through fixed x1 and x2 ? – Motosega May 6 '16 at 19:34
• @Motosega - see edit. Pick a point, any point ... – Bob Hanlon May 6 '16 at 20:18
• it doesn't work. This code don't draw the blue curve... – Motosega May 6 '16 at 20:33
• @Motosega - Works fine here. Try starting with a fresh kernel, perhaps you have some old definitions laying around. – Bob Hanlon May 6 '16 at 20:39