I assume that you want that the corners of the rectangle be along the sides of the triangles.
The equations of the lines which define the triangle are y = 3 x and y = 4 - x.
Now, let use define four points (x1,0), (x1,y1), (x2,0) and (x2,y2) which will define the rectangle. Since it is a rectangle, y2 = y1. Now, use the equations y1 = 3 x1 and y2 = 4 - x2; since y1 = y2, then 3 x1 = 4 - x2 which can reduce to x2 = 4 - 3 x1.
The area of the rectangle is defined by Area = (x2 - x1) y2 that is to say
Area = (4 - 4 x1) (3 x1) = 12 (1 - x1) x1.
You want this area to be maximized. Compute the derivative of the area with respect to x1 and set it to zero. This will give you the value of x1; from it, x2 = 4 - 3 x1, y = 3 x1 ...
I am sure you can take from here.