How to show that right triangle is intersection of two rectangles in Cartesian coordinates? I am trying to do the following.
Given the triangle
$$T:=\left\{(x,y)\mid 0\leq x\leq h,0\leq y\leq k,\frac{x}{h}+\frac{y}{k}\leq1\right\}$$
find two rectangles $R$ and $S$ such that $R\cap S=T$, $\partial R\cap T$ is the two legs of $T$, and $\partial S\cap T$ is the hypotenuse of $T$ union the vertex of $T$. The rectangle $R$ should be of smallest area.
For example, for $h=4$ and $k=3$,

Clearly,
$$R=\left\{(x,y)\mid 0\leq x\leq h,0\leq y\leq k\right\}.$$
I am having trouble coming up with a description of $S$ to show that $R\cap S=T$.
I have that $S$ has side lengths
$$\sqrt{h^2+k^2}\qquad\textrm{and}\qquad\frac{hk}{\sqrt{h^2+k^2}}$$
and corners at
$$(0,k)\qquad(h,0)\qquad\left(\frac{h^3}{h^2+k^2},-\frac{h^2k}{h^2+k^2}\right)\qquad\left(-\frac{k^3}{h^2+k^2},\frac{hk^2}{h^2+k^2}\right).$$
How do I describe $S$ in a way that I can show $R\cap S=T$?
 A: The rectangle $S$ is given by
$$S= \{(x,y)\mid 0\le kx+hy\le hk\land -k^2\le hx-ky\le h^2\}$$
Assuming you can show that such a set is a rectangle in the first place, the intersections, i.e. combination of inequaliteis are readily handled.
A: Using your picture, the algebraic idea is quite clear ; take $S$ to be the rectangle whose longest side is the hypothenuse of your triangle and whose height is the distance between the corner of the right angle and the hypotenuse. Take $R$ whose sides are the two smaller sides of the triangle. Then 'do the math' algebraically. 
Note ; you can take rectangle that are bigger, for instance instead of taking $R$ to be the rectangle with the sides of the triangle, you could take longer sides as long as the rectangle $R$ has a corner in common with the triangle.
Hope that helps,
A: Note that $\frac{x}{h}+\frac{y}{k}=1$ is equivalent to $y=-\frac{k}{h}x+k$.
Define
$$H_1=\left\{(x,y)\mid y\leq-\frac{k}{h}x+k\right\}\\
H_2=\left\{(x,y)\mid y\leq\frac{h}{k}x+k\right\}\\
H_3=\left\{(x,y)\mid y\leq\frac{h}{k}x-\frac{h^2}{k}\right\}\\
H_4=\left\{(x,y)\mid y\leq-\frac{k}{h}x\right\}.$$
Show that $H_1\cap H_2\cap H_3\cap H_4$ is such a rectangle that fits your condition for $S$, and that
$$H_1\cap R=T\\
H_2\cap R=R\\
H_3\cap R=R\\
H_4\cap R=R;$$
thus, $H_1\cap H_2\cap H_3\cap H_4\cap R=T$.
(Note that $\partial H_1\parallel\partial H_4$, $\partial H_2\parallel\partial H_3$, and $\partial H_1\perp\partial H_2$, according to the point-slope form of the equations given for the definitions of $H_1$, $H_2$, $H_3$, and $H_4$.)
