# How can I plot a function with parameters x,y but only in the x<y region

I want to use DensityPlot to plot the function, let's say f[x,y]=xy, but only in the x<y region with 0<x<3, 1<y<4. How can I do this? What about other regions?

Here is a starting point.

ClearAll[f]
f[x_, y_] := x y

2. Then set up a density plot using DensityPlot and specifying appropriate ranges for the $$x$$ and $$y$$ variables; then provide an appropriate RegionFunction option to specify that the plot should only be drawn wherever $$x:

DensityPlot[
f[x, y], {x, 0, 3}, {y, 1, 4},
RegionFunction -> Function[{x, y, z}, x < y]
] 1. For more complex regions, the approach is similar, except that you should have a way of generating a function that reports on whether an $$(x,y)$$ point is within your desired plotting region or not. Here is an example with a triangular region:

rmf = RegionMember@Triangle[{{1.5, 1}, {2.5, 3}, {0.5, 3}}]
DensityPlot[
f[x, y], {x, 0, 3}, {y, 1, 4},
RegionFunction -> Function[{x, y, z}, rmf[{x, y}]],
PlotPoints -> 30
] Another approach is to define your function only for $$x as follows

f[x_,y_]:=x y/;x<y
DensityPlot[f[x,y],{x,0,3},{y,1,4}]


this give you the same graphics. 