I need equation of a rectangle on the Cartesian coordinate system. Is there an equation for a rectangle? for example equation of ellipse is $$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$
-
I ment equation of ellipse is x²b²+y²a²=a²b² sorry for the mistake :-) – Jul 30 '14 at 12:45
-
1You can edit your question, you know? – 5xum Jul 30 '14 at 12:46
-
Shall I consider the OP does not exist on SE? – MonK Jul 30 '14 at 14:01
4 Answers
There is no simple equation By that I mean that there is no "nice" function $f(x,y)$ for which $f(x,y)=0$ would determine a rectangle. Of course such a function exists, it's just not useful or nice to look at. For example, for the square with edges $(-1,-1),(-1,1),(1,-1),(1,1)$, you can take the function $$f(x,y) = \max\{|x|,|y|\} - 1$$ which yields the square when equaled to $0$.
You can now stretch and move this function, so $f(x-a, y-b) = 0$ will create a square with sides of length $2$ and center at $(a,b)$. $f(\frac xc,\frac yd) = 0 $ will create a square with sides $c,d$ centered at the origin. $f(\frac{x-a}c, \frac{y-b}d$ will create a rectangle with sides $c,d$, centered at $a,b$.
That said, I think a much better way of describing such rectanles is $[a,b]\times [c,d]$ (for the full rectangle, or the edge of this set for the edge alone).

- 123,496
- 6
- 128
- 204
-
For a 'non-nice' implicit function, refer to the answer here: http://math.stackexchange.com/questions/69099/equation-of-a-rectangle – fixedp Jul 30 '14 at 12:51
-
For a rectangle centered at $(a,b)$ with $l=$ side length parallel to the $x$-axis and $m=$ side length parallel to the $y$-axis, the equation is $$\text{Max} \biggl( \frac{2 \, |x-a|}{l}, \frac{2 \, |x-b|}{m} \biggr)= 1 $$

- 120,280
A curious equation : $$\lim_{n \to \infty}\left({\left(\frac{x}{a}\right)^{2n} + \left(\frac{y}{b}\right)^{2n}}\right) = 1$$ For $-a<x<a$ then $\frac{x^2}{a^2}<1$ then $\left(\frac{x^2}{a^2}\right)^\infty=0$. Hense $\frac{y^2}{b^2}=1$ . So $y=b$ or $y=-b$ which gives the upper and the lower sides of the rectangle.
For $-b<y<b$ then $\frac{y^2}{b^2}<1$ then $\left(\frac{y^2}{b^2}\right)^\infty=0$. Hense $\frac{x^2}{a^2}=1$ . So $x=a$ or $x=-a$ which gives the right and the left sides of the rectangle.
http://mathworld.wolfram.com/Superellipse.html
http://mathworld.wolfram.com/Rectellipse.html

- 66,221
- 3
- 37
- 87
The answers above kind of look more complex than needed so here is my take on the problem. We begin with absolute value function to form a diamond shape: $$y(x)=|x|\Rightarrow |x|+|y|=a\sqrt{2}\Rightarrow\text{Cylindrical coordinates}$$ The reason behind this step is for us to rotate it by 45 degrees: $$|r\text{cos}\phi|+|r\text{sin}\phi|=a\sqrt{2}\Rightarrow\phi\rightarrow\phi+\frac{\pi}{4}$$ $$\Rightarrow|r\text{cos}(\phi)-r\text{sin}(\phi)|+|r\text{cos}(\phi)+r\text{sin}(\phi)|=2a$$ Since we rotated it 45 deg. we must now revert it to Cartesian coordinates: $$|x-y|+|x+y|=2a$$ Now we have a square with side $a$ but we got to stretch it in the $x$ direction. To do this we simply substitute $x\rightarrow \frac{a}{b}x$ as if we shrank it earlier to get a square. And voila! We get the equation for a rectangle with centre in (0,0) and with sides a,b in Cartesian coordinates: $$|ax-by|+|ax+by|=2ab$$
You can check desmos to make a plot of this equation!