Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let say I have the following triangles,

enter image description here

I know the distance which is same. I know all the co-ordinates. How to get inner triangle co-ordinates?

Edit: I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.

share|cite|improve this question
The right angle of the inner triangle is at $(5,5)$, which is outside the outer triangle, so something is screwy here. – Gerry Myerson Apr 12 '12 at 6:05
@GerryMyerson, this is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:06
Also, you've posted a bunch of questions of pretty much this type. Have you learned anything from the solutions to all those other problems? – Gerry Myerson Apr 12 '12 at 6:07
I have learnt a lot @GerryMyerson. Thanks for this perfact site. Currently, I am using a method which is not working perfactly. That's why I asked another one. – user960567 Apr 12 '12 at 6:13
up vote 1 down vote accepted

It seems to me that what many of your problems have in common is a given line $L$ and a given distance $d$ and you want a line $M$ parallel to $L$ and at distance $d$ from $L$, so let's solve this problem once and for all and then maybe you can solve all your problems.

Let the line $L$ be given by $y=mx+b$. Pick any point $P$ on this line, say, $P=(0,b)$. The line through $P$ perpendicular to $L$ has equation $$y=-(1/m)x+b$$ We want a point $Q$ on this line at distance $d$ from $(0,b)$, so we want $$x^2+(y-b)^2=d^2$$ So we have two (displayed) equations in the two unknowns $x,y$. The first equation says $y-b=-x/m$, and sticking that in the second equation we get $x^2+(x^2/m^2)=d^2$ which you can solve for $x$, getting $x=\pm dm/\sqrt{m^2+1}$. Then you can use the first displayed equation to get $y$. Note that there are two solutions, one on either side of the line $L$. In practice, you should have no difficulty telling which of the two possibilities for $Q$ is the one you want.

Now that you have the coordinates for $Q$, let's say $Q=(r,s)$, the equation of the line $M$ is simply $y=m(x-r)+s$.

Now you generally want vertices, not lines, but that's easily taken care of; once you have the equations of the lines that form your polygon, you find the vertices by solving pairs of equation of lines simultaneously.

You may have to be a little careful with the formulas if the lines involved are horizontal or vertical, but these are the easy cases where you don't really need to do all the work outlined above anyway.

As an exercise, try to carry out these steps with your triangle-in-a-triangle.

share|cite|improve this answer
How you can say that (0,b) is on line. This will not always the case. Note, using vectors I can easily get a point from edges to distance d. But this is not giving correct result. – user960567 Apr 12 '12 at 6:56
See my edited post. – user960567 Apr 12 '12 at 11:43
Aside from the special case of vertical lines, every line can be written as $y=mx+b$. How can you deny that $(0,b)$ is on this line? It may not be on the part of the line that interests you, but for the purpose of finding a parallel line at a given distance that doesn't matter. – Gerry Myerson Apr 12 '12 at 12:38
Polygon has lot of chances that they have one(or more) vertical and horizontal lines. So, I can't assume(0,b) and (a,0). BTW, thanks. I am using the solution present in my question. Any suggestion will be welcome. – user960567 Apr 13 '12 at 2:29
The horizontal and vertical lines are easy to deal with. The lines at distance $d$ from the vertical line $x=a$ are the lines $x=a+d$ and $x=a-d$. Similarly for the horizontal lines. – Gerry Myerson Apr 13 '12 at 6:56

With your particular numbers, the diagram does not quite work. But I will give a procedure that works if you want the distances to be, say $2$.

The equation of our slanted line is $8x+6y-48=0$. We find for example the coordinates of the rightmost corner of the little triangle. Its $y$-coordinate is $2$. Let the $x$-coordinate be $p$.

The distance from $(p,2)$ to the slanted line is given by $$\frac{|8p+6\cdot 2-48|}{\sqrt{8^2+6^2}}.$$ Set this equal to $2$. There are two solutions $p$. Discard the one which is outside the big triangle.

share|cite|improve this answer
The triangle(or may be it is polygon) can be anything. I need generic solution. So, I cannot use p,2. I am currently getting the co-ordinates using the vectors from all edges of outer triangle. For e.g, (0,0) to distance=8, I can get another co-ordinates using vectors. But this is not giving correct result. – user960567 Apr 12 '12 at 6:18
For a right triangle, put the right angle at the origin, the other two vertices along the axes. Exactly the same method will work, I picked distance $2$ for concreteness, since your question was concrete. Of course exactly the same procedure works if we use $d$ instead of $2$. In the general case, find equations for the sides, and use the same distance formula. But we will have to work with general point $(p,q)$ and make the distances to consecutive edges equal to $d$. For each vertex that gives two equations in two unknowns. – André Nicolas Apr 12 '12 at 6:24
But it is not neccessary a right angle triangle. – user960567 Apr 12 '12 at 6:36
If you know the vertices of the big triangle, you can find the equations of the lines that form the edges. Then see my comment just above. – André Nicolas Apr 12 '12 at 6:39
I know how to get the new co-ordinates from edges using simple vectors and the distance from edges to a inner triangle points is always same. But this is not correct. You can visualize this. – user960567 Apr 12 '12 at 6:44

Let's denote distance as $d$ .Since inner triangle (see picture below) is similar to the outer triangle it follows :

$6 : 8 = \sqrt{(x_B-d)^2+(d-d)^2} : \sqrt{(y_C-d)^2+(d-d)^2} $

Since inner triangle is right-angled triangle it follows :


So you have a system of two equations in two unknowns .

enter image description here

share|cite|improve this answer
This is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:35
@user960567 I guess that you know how to solve system of two equations in two unknowns...System of equations in two variables – pedja Apr 12 '12 at 6:41
Please see the aboive comments – user960567 Apr 12 '12 at 6:46
See my edited post. – user960567 Apr 12 '12 at 11:43

From your diagram, the point at right angle of the inner triangle is at (5,5), which is outside the outer triangle. you can draw two triangles using coordinating system. Please check your problem.

share|cite|improve this answer
This is just an example. Triangle can be any co-ordinates and distance can be anything. Please give me the solution. – user960567 Apr 12 '12 at 6:34
Your answer, Prasad, does it add anything to my first comment on the original question? – Gerry Myerson Apr 12 '12 at 6:39
See my edited post. – user960567 Apr 12 '12 at 11:43

I had come across a similar problem when I was doing stuff with THREE.js

For the sake of simplicity assume the triangle is equilateral; one of its vertices is at the origin, and one of its sides is along the $x$-axis; and its side length $p$.

Now the vertices of the above triangle are $A\space(0,0)$, $B\space(p, 0)$, and, $C\space(\frac{p}{2}, \frac{p\sqrt3}{2})$

The procedure goes like this:

I am trying to find a line parallel to $AC$ but at a perpendicular distance $p$

  1. Conside line $AC$. Slope $ = m = \frac{y_2 - y_1}{x_2-x_1} = \sqrt3 \implies \theta = 60^\circ $

    Equation of the line, $y = \sqrt3x$

    A line normal to this would have slope $m = -\frac{1}{\sqrt3}$ or $\theta' = 150^\circ ( = 60^\circ + 90^\circ)$

    $\therefore$ its equation would be $y = -\frac{1}{\sqrt3}x$

    Note: slope form of line is $y = mx + c$. We normally have to compute for $c$, but since our line passes through origin $c = 0$

  2. Assume a circle with center at origin, and radius $d$, i.e. $x^2 + y^2 = d^2$

    Any point of this circle $P_\alpha (d\space cos\space\alpha, d \space sin \space \alpha)$. Its diametrically opposite point $P_\alpha' (d\space cos\space (180^\circ + \alpha), d \space sin \space (180^\circ + \alpha))$

    We find the points for $\theta'$

  3. In order to decide which of the two points to consider, use this formula. We consider the vertex opposite to $AC$, i.e. $B\space (p,0)$. We compute the quantities using points $B, P_{\theta'}$, and $P_{\theta'}'$; select result that has the same sign of $B$'s result.

    Now its easy to get the equation of the line parallel to AC

Repeat this procedure for the other two sides, solve the equations for the intersecting lines, and you get the coordinates of the inner triangle.

And you get a result like: $A'\space(d(1+\frac{1}{\sqrt3}), d)$, $B' \space (p-d\sqrt3, p)$, and, $C' \space (\frac{p}{2}, \frac{p\sqrt3}{2} - d(1-\frac{1}{\sqrt3}))$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.