# How to show multiple functions on the same plot? [closed]

I tried this:

f[x_] := (x^2 - 1) (x^2 - 2)
g[x_] := (x^2 - 1) (x^2 - 2) + 3 sin (20 x)
p1 = Plot[f[x], {x, 0, 3}, PlotStyle -> Orange]
p2 = Plot[g[x], {x, 0, 3}, PlotStyle -> Blue]
Show[p1, p2]


However, that didn't produce a single plot with the two functions in different colors that I expected. What am I doing wrong here?

• Functions in Mathematica start with a capital letter and use square braces, e.g. use Sin[20 x] instead of sin (20 x). – user6014 Aug 27 '19 at 16:59
• Thanks, @user6014, of course! Sin[20 x] worked as expected. – Michael Aug 27 '19 at 17:09
• You can use a single Plot: Plot[{f[x], g[x]}, {x, 0, 3}, PlotStyle -> {Orange, Blue}, PlotLegends -> Placed["Expressions", {0.5, 0.5}]] – Bob Hanlon Aug 27 '19 at 17:28

After fixing the syntax error, you can also use your list of functions in the first argument and a list of colors in PlotStyle option setting to get the desired result more conveniently with a single Plot command:
Plot[{f[x], g[x]}, 