Triangle formed by straight lines

AI Thread Summary
The discussion focuses on determining the area of a triangle formed by the intersection of three lines defined by inequalities. Participants emphasize the importance of rewriting equations in standard form and checking whether points lie inside the triangle by testing inequalities. The method involves finding vertices through intersections and evaluating points against the inequalities to establish their positions relative to the triangle. A key point raised is the relationship between the areas of sub-triangles formed with test points to confirm their inclusion within the main triangle. Overall, the conversation highlights various approaches to solving the problem while stressing the significance of understanding inequalities and geometric relationships.
Einstein44
Messages
125
Reaction score
31
Homework Statement
A triangle in the plane is formed by straight lines
##\left.\begin{matrix}
2x+y=2\\
2x+3y=6\\
x-y=1
\end{matrix}\right\}##

Which of the points P(1,1) and Q(1,2) lie in the interior of the triangle and which outside the triangle?

NOTE: No drawings or sketches are allowed as part of the solution.
Relevant Equations
.
I tried doing this problem, but couldn't find a solution that wouldn't involve a sketch... Finding the vertices was all I've got.

Thanks in advance.
 
Physics news on Phys.org
The triangle is the intersection of three half-planes defined by the inequalities obtained by replacing each of the equals signs in the above three equations by either ##\geq## or ##\leq##.
Once you have done those replacements, you can check whether a point is in the triangle by just testing whether it obeys all three inequalities.
For each equation, work out whether to replace the equals sign by ##\geq## or ##\leq## by finding the point of intersection of the other two lines - which you know lies on the triangle - and seeing whether it obeys the inequality with the equals replaced by ##\geq## or ##\leq##.
 
  • Like
  • Informative
Likes Office_Shredder and Einstein44
andrewkirk said:
The triangle is the intersection of three half-planes defined by the inequalities obtained by replacing each of the equals signs in the above three equations by either ##\geq## or ##\leq##.
Once you have done those replacements, you can check whether a point is in the triangle by just testing whether it obeys all three inequalities.
For each equation, work out whether to replace the equals sign by ##\geq## or ##\leq## by finding the point of intersection of the other two lines - which you know lies on the triangle - and seeing whether it obeys the inequality with the equals replaced by ##\geq## or ##\leq##.
This can't be quite right. If we try the origin in the third equation, then ##x = 0, y = 0 \ \Rightarrow \ x - y < 1##. But, if we replace the third equation with the equivalent ##y - x = -1##, then we find the opposite inequality for the origin.

I suggest you first have to rewrite the equations in the standard form ##y = mx + c##.
 
  • Informative
  • Like
Likes chwala and FactChecker
Einstein44 said:
I tried doing this problem, but couldn't find a solution that wouldn't involve a sketch...
Neither could I.
 
I did it the way I described, and it gave the correct answer. I can't give details though, as I need to leave some work for the homework posters to do, so they can learn.

I don't see why the observation regarding the origin should cause an objection.

The LHS of each equation is a linear function of x and y, and all level sets (iso-lines) of such a function are parallel to one another. A given RHS number, with an equals sign, defines a specific iso-line, and all level sets giving less than that number are on one side of that, while all those giving more are on the other. If we change the linear function - we can expect the level sets and the chosen inequalities to change. If we change the function only by multiplying by a constant, the level sets will not change, but the values on each set will. If the constant is negative, eg when we replace ##x-y## by ##y-x## (constant is -1), the inequality will change.
 
andrewkirk said:
I did it the way I described, and it gave the correct answer. I can't give details though, as I need to leave some work for the homework posters to do, so they can learn.

I don't see why the observation regarding the origin should cause an objection.
Let's see what the OP comes up with. I'm interested in what your criteria are for a point lying inside the triangle.
 
andrewkirk said:
The triangle is the intersection of three half-planes defined by the inequalities obtained by replacing each of the equals signs in the above three equations by either ##\geq## or ##\leq##.
Once you have done those replacements, you can check whether a point is in the triangle by just testing whether it obeys all three inequalities.
For each equation, work out whether to replace the equals sign by ##\geq## or ##\leq## by finding the point of intersection of the other two lines - which you know lies on the triangle - and seeing whether it obeys the inequality with the equals replaced by ##\geq## or ##\leq##.
Okay so I have tried to work this out like you said, although a bit confused. Please correct me if I did any mistakes in here.

First rearranged the equations in the form ##y=mx+c##:
##
\left.\begin{matrix}
y= -2x+2\\
y=-\frac{2}{3}x+2\\
y=x-1
\end{matrix}\right\}triangle
##
Then, finding the vertices by equating all of the equations returns the 3 points:
##
\left.\begin{matrix}
A (0,2)\\
B (1,0)\\
C(\frac{9}{5}, \frac{4}{5})
\end{matrix}\right\}
##
Then, for example, for the first equation, ##y= -2x+2##, using the intersect between the other two lines, which is point ##C##, shows me that it must lie above the line and hence give the inequality ##y\geq -2x+2##
Thus, inserting point ##P(1,1)## into this inequality returns ##1\geq0##, which is ##\top##
I repeated this for all other inequalities, for point P, as well as Q. Point P was all ##\top## and some for Q were false, concluding that P lies within the triangle and Q outside of it.

I also checked the inequality symbols by inserting a point (0,0) to be sure. I am not sure if I have done this correctly, but that is all I could come up with. Please correct me.
 
Last edited:
Einstein44 said:
Okay so I have tried to work this out like you said, although a bit confused. Please correct me if I did any mistakes in here.

First rearranged the equations in the form ##y=mx+c##:
##
\left.\begin{matrix}
y= -2x+2\\
y=-\frac{2}{3}x+2\\
y=x-1
\end{matrix}\right\}triangle
##
Then, finding the vertices by equating all of the equations returns the 3 points:
##
\left.\begin{matrix}
A (0,2)\\
B (1,0)\\
C(\frac{9}{5}, \frac{4}{5})
\end{matrix}\right\}
##
Then, for example, for the first equation, ##y= -2x+2##, using the intersect between the other two lines, which is point ##C##, shows me that it must lie above the line and hence give the inequality ##y\geq -2x+2##
Thus, inserting point ##P(1,1)## into this inequality returns ##1\geq0##, which is ##\top##
I repeated this for all other inequalities, for point P, as well as Q. Point P was all ##\top## and some for Q were false, concluding that P lies within the triangle and Q outside of it.

I also checked the inequality symbols by inserting a point (0,0) to be sure. I am not sure if I have done this correctly, but that is all I could come up with. Please correct me.
I couldn't do this without using a sketch to justify the criteria. Eventually, we can perhaps state the purely algebraic criteria with confidence and who's to say that we needed a sketch to come up with the criteria in the first place? As long as you don't submit the sketch as part of your solution!

Let's take the two points we are given, ##P## and ##Q##, and add the origin ##O## as well to give us more data. Now, taking the lines in the order given, we plug in the ##x## value of our point and say whether the ##y## value is greater than or less than the expression in ##x## on the RHS:

For the point ##P(1,1)## we have: ##>, <, >##

For the point ##Q(1, 2)## we have: ##>, >, >##.

For the origin ##O(0,0)## we have: ##<, <, >##.

You could choose some other points inside the triangle or at locations outside the triangle and look at the three inequalities and see whether you can deduce a pattern for points inside and outside the triangle.
 
@Einstein44, how about this...

Calculate the areas of the various triangles: ##A_0=##Area(ABC), ##A_1=##Area(ABP), ##A_2=##Area(BCP) and ##A_3##=Area(CAP).

If P is internal (or lies on a side), what is the relationship between ##A_0, A_1, A_2## and ##A_3##?

If using this approach, there is handy formula (if allowed) for a triangle’s area in terms of the coordinates of its vertices, e.g. see https://mathopenref.com/coordtrianglearea.html.
 
  • #10
Steve4Physics said:
@Einstein44, how about this...

Calculate the areas of the various triangles: ##A_0=##Area(ABC), ##A_1=##Area(ABP), ##A_2=##Area(BCP) and ##A_3##=Area(CAP).

If P is internal (or lies on a side), what is the relationship between ##A_0, A_1, A_2## and ##A_3##?

If using this approach, there is handy formula (if allowed) for a triangle’s area in terms of the coordinates of its vertices, e.g. see https://mathopenref.com/coordtrianglearea.html.
I suspect the simplest approach is to look at the point in relation to the lines given!
 
  • #11
Steve4Physics said:
@Einstein44, how about this...

Calculate the areas of the various triangles: ##A_0=##Area(ABC), ##A_1=##Area(ABP), ##A_2=##Area(BCP) and ##A_3##=Area(CAP).

If P is internal (or lies on a side), what is the relationship between ##A_0, A_1, A_2## and ##A_3##?

If using this approach, there is handy formula (if allowed) for a triangle’s area in terms of the coordinates of its vertices, e.g. see https://mathopenref.com/coordtrianglearea.html.
Yes, I believe this would work, although perhaps more complicated. The solution refers to a method like the one stated by several threads above, however it is written in a way that does not really make sense on its own. The only thing I can tell is the use of some inequalities.
That's why I wanted to first try the method given in the solution, as I believe this problem is expecting me to use inequalities.
 
  • Like
Likes Steve4Physics
  • #12
PeroK said:
I couldn't do this without using a sketch to justify the criteria. Eventually, we can perhaps state the purely algebraic criteria with confidence and who's to say that we needed a sketch to come up with the criteria in the first place? As long as you don't submit the sketch as part of your solution!

Let's take the two points we are given, ##P## and ##Q##, and add the origin ##O## as well to give us more data. Now, taking the lines in the order given, we plug in the ##x## value of our point and say whether the ##y## value is greater than or less than the expression in ##x## on the RHS:

For the point ##P(1,1)## we have: ##>, <, >##

For the point ##Q(1, 2)## we have: ##>, >, >##.

For the origin ##O(0,0)## we have: ##<, <, >##.

You could choose some other points inside the triangle or at locations outside the triangle and look at the three inequalities and see whether you can deduce a pattern for points inside and outside the triangle.
What does that information about whether the retuned y-value from the functions is greater or lower than the one from the point?
 
  • #13
Einstein44 said:
What does that information about whether the retuned y-value from the functions is greater or lower than the one from the point?
I can't make sense of that question.
 
  • #14
PeroK said:
I can't make sense of that question.
"Let's take the two points we are given, P and Q, and add the origin O as well to give us more data. Now, taking the lines in the order given, we plug in the x value of our point and say whether the y value is greater than or less than the expression in x on the RHS:"

I am not sure what to conclude from this
 
  • #15
This is the solution:
Unfortunately I was not able to make sense of it, but perhaps it makes more sense now that I saw all the replies here.

The values of the linear functions which determine the sides of the triangle ##a(x,y) = 2x+y-2##, ##b(x,y)=2x-3y-6##, ##c(x,y)=x-y-1## opposite to vertices A, B, and C, correspondingly, take at these vertices signs +, −, −. At the point P they take signs +, −, −, and point Q signs +, +, −. Therefore P belongs to the interior of the triangle and Q does not
 
  • #16
Einstein44 said:
"Let's take the two points we are given, P and Q, and add the origin O as well to give us more data. Now, taking the lines in the order given, we plug in the x value of our point and say whether the y value is greater than or less than the expression in x on the RHS:"

I am not sure what to conclude from this
You can conclude that the point ##P## is above two lines and below one. The point ##Q## is above all three lines. And the origin is below two of the lines and above one.
 
  • #17
A triangle is a convex set. If you have the three vertices, then the point (1,1) is inside the triangle if and only if it is a convex combination (all coefficients are non-negative and sum to 1) of the vertices.
 
  • #18
Einstein44 said:
This is the solution:
Unfortunately I was not able to make sense of it, but perhaps it makes more sense now that I saw all the replies here.

The values of the linear functions which determine the sides of the triangle ##a(x,y) = 2x+y-2##, ##b(x,y)=2x-3y-6##, ##c(x,y)=x-y-1## opposite to vertices A, B, and C, correspondingly, take at these vertices signs +, −, −. At the point P they take signs +, −, −, and point Q signs +, +, −. Therefore P belongs to the interior of the triangle and Q does not
Let's assume from this that the rule is that ##+,-,-## indicates inside and ##+, +, -## indicates outside.

My point in post #3 is that if we rewrite ##c(x, y) = -x + y + 1##, which should be equivalent, then this changes the signs of point ##P## to ##+, -, +##.

There must be an added stipulation that we write the linear functions in a standard form with a positive coefficient for ##x##. This is why I suggested writing the lines in the standard ##y = mx + c## format. In any case, we must have a defined, standard format.

However, even then, does ##+, -, -## always indicate inside for all triangles, or are there some triangles where ##+, +, -## indicates inside?
 
  • #19
Einstein44 said:
This is the solution:
Unfortunately I was not able to make sense of it, but perhaps it makes more sense now that I saw all the replies here.

The values of the linear functions which determine the sides of the triangle ##a(x,y) = 2x+y-2##, ##b(x,y)=2x-3y-6##, ##c(x,y)=x-y-1## opposite to vertices A, B, and C, correspondingly, take at these vertices signs +, −, −. At the point P they take signs +, −, −, and point Q signs +, +, −. Therefore P belongs to the interior of the triangle and Q does not
Note that you should have ##b(x, y) = 2x + 3y-6##.
 
  • Like
Likes Einstein44 and FactChecker
  • #20
@Einstein44 I feel that this book is leading you astray, so I'll give you more of my analysis than I normally would for homework. Let's go back to my idea of using the format ##y = mx + c##.

Imagine a triangle with a horizontal base and area above the x-axis. It's clear that a point inside the triangle must be above the x-axis and below the other two lines. This would be a ##+, -, -## pattern.

If, however, we imagine the area below the x-axis, then the pattern would be ##-, +, +##.

What's clear is that the pattern of signs depends on the orientation of the triangle. We do not immediately know whether we are looking for ##+,+ -## or ##-, -, +##. It could be either.

I suggest, therefore, we also need to find a point definitely inside the triangle and test that. And see what pattern we are looking for. There are various ways to find one of those.

The book's method must suffer from the same problem that internal could be ##+, -, -## as in this case, but for a different triangle ##-, +, +## might indicate inside.

I'm also suspicious of a geometry teacher who asks you not to draw a sketch in this case, as all these algebraic ideas are essentially based on geometric ideas such as lines splitting planes into above and below. If the author did not sketch the problem, then I'm not suprised if they didn't fully grasp the possible solutions.
 
  • #21
PeroK said:
@Einstein44 I feel that this book is leading you astray, so I'll give you more of my analysis than I normally would for homework. Let's go back to my idea of using the format ##y = mx + c##.

Imagine a triangle with a horizontal base and area above the x-axis. It's clear that a point inside the triangle must be above the x-axis and below the other two lines. This would be a ##+, -, -## pattern.

If, however, we imagine the area below the x-axis, then the pattern would be ##-, +, +##.

What's clear is that the pattern of signs depends on the orientation of the triangle. We do not immediately know whether we are looking for ##+,+ -## or ##-, -, +##. It could be either.

I suggest, therefore, we also need to find a point definitely inside the triangle and test that. And see what pattern we are looking for. There are various ways to find one of those.

The book's method must suffer from the same problem that internal could be ##+, -, -## as in this case, but for a different triangle ##-, +, +## might indicate inside.

I'm also suspicious of a geometry teacher who asks you not to draw a sketch in this case, as all these algebraic ideas are essentially based on geometric ideas such as lines splitting planes into above and below. If the author did not sketch the problem, then I'm not suprised if they didn't fully grasp the possible solutions.
Thanks very much for your input. I will try this problem again, this time with a better understanding!

The reason geometry is not allowed for this problem, is because this is not actually from a geometry class. This problem is from one of my modules on inequalities, sets and logic (to summarise).
 
  • #22
PeroK said:
Note that you should have ##b(x, y) = 2x + 3y-6##.
Yes, you're right.
 
  • #23
Einstein44 said:
The reason geometry is not allowed for this problem, is because this is not actually from a geometry class. This problem is from one of my modules on inequalities, sets and logic (to summarise).
That's BS in my opinion. Maths is maths and interior/exterior of a triangle is geometry. If the book is wrong, that justifies my point!
 
  • #24
@PeroK sorry but you're wrong here. The exterior is not +,+,- the exterior is anything that doesn't match the single sign convention that defines the interior, so there are 7 sign patterns that all define the exterior. If you multiply both sides of the equation by -1, then you flip the sign of one of the defining inequalities, but that doesn't change anything. Whether any individual point satisfies the inequality is still the same.

Any polygon (or polytope in higher dimensions) is defined as the intersection of finitely many half spaces of the form ##<a,x> \leq b## for some ##a## and ##b##. If you have a > sign, multiplying both sides by -1 to turn it into a <, and absorbing the sign into your choice of a and b is standard.

@Einstein44 I'm happy to go into this in a bit more detail if it helps your understanding. Turning the equations into y=mx+b is especially not going to help your understanding when you start tackling higher dimensions.
 
  • #25
Office_Shredder said:
@PeroK sorry but you're wrong here. The exterior is not +,+,- the exterior is anything that doesn't match the single sign convention that defines the interior, so there are 7 sign patterns that all define the exterior. If you multiply both sides of the equation by -1, then you flip the sign of one of the defining inequalities, but that doesn't change anything. Whether any individual point satisfies the inequality is still the same.
I never said all exterior points had the same pattern, only that ##+, +, -## indicates exterior points in some cases. Post #8 shows that point ##Q## has a ##+, +, +##. Which must be exterior.

I don't see how you can have one sign convention for all triangles simultaneously?
 
  • #26
PeroK said:
I never said all exterior points had the same pattern, only that ##+, +, -## indicates exterior points in some cases. Post #8 shows that point ##Q## has a ##+, +, +##. Which must be exterior.

I don't see how you can have one sign convention for all triangles simultaneously?

The sign convention is a function of the equations that define the triangle. A triangle whose edges are ##y=1##,##x=1## and ##x+y=0## has interior ##y-1<0##, ##x-1<0##, ##x+y>0##.

Equivalently, ##-y+1##, ##-x+1>0##, ##x+y>0##. This gives a different sign convention. As does ##y-1<0##, ##-x+1>0##, and ##-x-y<0##. For any triangle, you can rewrite the inequalities to make any triple of signs the one that defines the interior. Each one is taking about the sign of different equationsthough
 
  • #27
Take the triangle defined by:
$$a(x, y) = y, \ b(x, y) = x - y, \ c(x, y) = x + y - 1$$And consider the interior point ##(\frac 1 2, \frac 1 4)##. The pattern is: ##+, +, -##, which is opposite to the ##+, -, -## pattern that indicated the interior of the triangle in the question. So, by some method, we have to establish the sign convention for the triangle in question.
 
  • #28
PeroK said:
Take the triangle defined by:
$$a(x, y) = y, \ b(x, y) = x - y, \ c(x, y) = x + y - 1$$And consider the interior point ##(\frac 1 2, \frac 1 4)##. The pattern is: ##+, +, -##, which is opposite to the ##+, -, -## pattern that indicated the interior of the triangle in the question. So, by some method, we have to establish the sign convention for the triangle in question.

The way you do it is by computing the vertices and checking each one against its opposite side.
 
  • #29
Office_Shredder said:
@PeroK sorry but you're wrong here. The exterior is not +,+,- the exterior is anything that doesn't match the single sign convention that defines the interior, so there are 7 sign patterns that all define the exterior. If you multiply both sides of the equation by -1, then you flip the sign of one of the defining inequalities, but that doesn't change anything. Whether any individual point satisfies the inequality is still the same.

Any polygon (or polytope in higher dimensions) is defined as the intersection of finitely many half spaces of the form ##<a,x> \leq b## for some ##a## and ##b##. If you have a > sign, multiplying both sides by -1 to turn it into a <, and absorbing the sign into your choice of a and b is standard.

@Einstein44 I'm happy to go into this in a bit more detail if it helps your understanding. Turning the equations into y=mx+b is especially not going to help your understanding when you start tackling higher dimensions.
It was said: "so there are 7 sign patterns that all define the exterior". In fact, the exterior of a triangle is described by 6 areas. Three are each adjacent to a side of the triangle; these are inside of two of the lines, but outside the third. Three are each adjacent to a vertex; these are inside of one of the lines, but outside the other two. What this means is that of the 8 possible sign patterns, 1 indicates the interior, 6 indicate the exterior, and 1 is forbidden. Which I find interesting. The forbidden area would be on the outside of all three lines, but this is geometrically impossible.
 
Last edited:
  • Like
Likes Office_Shredder
  • #30
FinBurger said:
It was said: "so there are 7 sign patterns that all define the exterior". In fact, the exterior of a triangle is described by 6 areas. Three are each adjacent to a side of the triangle; these are inside of two of the lines, but outside the third. Three are each adjacent to a vertex; these are inside of one of the lines, but outside the other two. What this means is that of the 8 possible sign patterns, 1 indicates the interior, 6 indicate the exterior, and 1 is forbidden. Which I find interesting. The forbidden area would be on the outside of all three lines, but this is geometrically impossible.

Ah, good point.
 
  • #31
Einstein44 said:
Thanks very much for your input. I will try this problem again, this time with a better understanding!

The reason geometry is not allowed for this problem, is because this is not actually from a geometry class. This problem is from one of my modules on inequalities, sets and logic (to summarise).
I can't see how you could figure this out from sets and logic without having some geometric insight. I certainly could make no progress without a sketch. I think I understand the book's solution. We label the three lines ##A, B, C##, then the vertices opposite these lines ##V_A, V_B, V_C##.

Then, taking these in order: ##V_A## satifies the linear equations of lines ##B## and ##C## and we compute its value for the linear equation for line ##A##. We can call this function ##a## or ##a(x, y)##. We note whether its value is positive of negative. Then do the same for vertices ##V_B## and ##V_C##. The pattern we get in this case is ##+, -, -##. This is then the pattern we are looking for in the next step, which is to compute the three linear functions for the point in question. If we get the same pattern (in this case ##+, -, -##) it's an interior point. Otherwise, it's outside the triangle.

Unless this has been covered by your course (?) I don't see how you could figure this out for yourself.
 
  • #32
FinBurger said:
It was said: "so there are 7 sign patterns that all define the exterior". In fact, the exterior of a triangle is described by 6 areas. Three are each adjacent to a side of the triangle; these are inside of two of the lines, but outside the third. Three are each adjacent to a vertex; these are inside of one of the lines, but outside the other two. What this means is that of the 8 possible sign patterns, 1 indicates the interior, 6 indicate the exterior, and 1 is forbidden. Which I find interesting. The forbidden area would be on the outside of all three lines, but this is geometrically impossible.
Neverthless, if we take my example:
$$a(x, y) = y, \ b(x, y) = x - y, \ c(x, y) = x + y - 1$$And consider the point ##(2, 1)##, we find that:
$$a(2, 1) = 1, \ b(2, 1) = 1, \ c(2, 1) = 2$$And, impossible or not, we have the ##+, +, +## signature!
 
  • #33
PeroK said:
Neverthless, if we take my example:
$$a(x, y) = y, \ b(x, y) = x - y, \ c(x, y) = x + y - 1$$And consider the point ##(2, 1)##, we find that:
$$a(2, 1) = 1, \ b(2, 1) = 1, \ c(2, 1) = 2$$And, impossible or not, we have the ##+, +, +## signature!

I think you're missing this conceptually. The impossible sign pattern for this, if I did the math right, is -,-,+. Because y<0 from the first one, the second one makes x<y<0, then the third one is the sum of three negative numbers so can't be positive.
 
  • #34
Office_Shredder said:
I think you're missing this conceptually. The impossible sign pattern for this, if I did the math right, is -,-,+. Because y<0 from the first one, the second one makes x<y<0, then the third one is the sum of three negative numbers so can't be positive.
There's an 8th forbidden gluon state as well!

https://en.wikipedia.org/wiki/Gluon#Eight_colors
 
  • #35
I guess a neat fact, the impossible combination is sign flipped in every spot from the interior, which I guess is another way to figure out which one the interior is. It's not hard to deduce in the original problem that -,+,+ is the impossible combination.
 
  • #36
I deleted my precious attempt. I think this algorithm will work. It ain’t pretty. It generalizes Perok’s approach.
1) Find the longest side of the triangle (one way is define normalized direction vectors for each line and then take inner products to find the largest angle)
2) Redefine the coordinate system so that the longest side of the triangle is on the new x-axis. Notice that the triangle is now above or below the new x-axis. Also since the longest side is on the axis, both of the angles opposite to the other two sides are acute.
4) Determine if the point is above or below the new x-axis.
5) If it above the new x-axis, it needs to be below the other two lines (in the new coordinate system). If it below the new x-axis, it needs to be above the other two lines (in the new coordinate system).
 
  • #37
Frabjous said:
I deleted my precious attempt. I think this algorithm will work. It ain’t pretty. It generalizes Perok’s approach.
1) Find the longest side of the triangle (one way is define normalized direction vectors for each line and then take inner products to find the largest angle)
2) Redefine the coordinate system so that the longest side of the triangle is on the new x-axis. Notice that the triangle is now above or below the new x-axis. Also since the longest side is on the axis, both of the angles opposite to the other two sides are acute.
4) Determine if the point is above or below the new x-axis.
5) If it above the new x-axis, it needs to be below the other two lines (in the new coordinate system). If it below the new x-axis, it needs to be above the other two lines (in the new coordinate system).

But we agree this is significantly worse than the solution from the book right?
 
  • Like
Likes PeroK and Einstein44
  • #38
Office_Shredder said:
But we agree this is significantly worse than the solution from the book right?
Mine is a painful solution. With yours, I am unsure of how to setup the direction of the inequalities without drawing a figure which we were forbidden to do.
 
  • #39
Frabjous said:
Mine is a painful solution. With yours, I am unsure of how to setup the direction of the inequalities without drawing a figure which we were forbidden to do.
The idea with the vertices and seven regions can be made ultimately purely algebraic. My issue is how you arrive at that without drawing a sketch. Moreover, how exactly is the interior of a triangle defined if not from a sketch? Even if the sketch is a mental picture of the plane geometry involved.

Once you have things nailed down in 2-3 dimensions, you may have to trust to algebra when generalizing.
 
  • #40
PeroK said:
The idea with the vertices and seven regions can be made ultimately purely algebraic. My issue is how you arrive at that without drawing a sketch. Moreover, how exactly is the interior of a triangle defined if not from a sketch? Even if the sketch is a mental picture of the plane geometry involved.

Once you have things nailed down in 2-3 dimensions, you may have to trust to algebra when generalizing.

The interior of the triangle is the only bounded intersection of three half spaces defined by splitting the plane by the given equations.

Yes i agree if you are given this question without having worked with polygons before like this drawing a picture is a good way to gain some intuition. This is like complaining if someone asks a question about continuous functions that doesn't permit a picture as a proof - the whole point is to take your picture, and turn it into an actual math proof.
 
  • #41
Frabjous said:
Mine is a painful solution. With yours, I am unsure of how to setup the direction of the inequalities without drawing a figure which we were forbidden to do.
I missed the book solution in post 15. It uses the vertices to determine the directions. I feel like an idiot obtuse.
 
Last edited:
  • Like
Likes Office_Shredder
  • #42
Frabjous said:
I missed the book solution in post 15. It uses the vertices to determine the directions. I feel like an idiot.

There's a lot going on in this thread. I was genuinely checking that you agreed with the book solution, since it seems easy to miss it in the conversation.
 
  • #43
1672720255059.png

This diagram helps understand how the logic works but importantly you do not need it to do the calculation.

We define functions ##f_1,f_2,f_3## that assign a real number to each point on the plane, where for point ##\mathbf v##, the value of ##f_i(\mathbf v)=f_i((x,y))## is that of the LHS of the ##i##-th equation in the OP, where ##x,y## are the Cartesian coordinates of ##\mathbf v##.

For each ##i\in\{1,2,3\}## and each ##u\in\mathbb R##, the level set$$S_{i}(u):= \left\{ \mathbf v\in\mathbb R^2\ :\ f_i(\mathbf v) = u\right\}$$is a straight line. For a given ##i##, all level sets are parallel. The value of ##f_i((x,y))## increases in a direction perpendicular to those lines, but we don't yet know which of the two perpendicular directions it is (eg NorthEast or SouthWest).

Define ##b_i## to be the constant on the RHS of the ##i##-th equation in the OP. So we can write the ##i##-th equation as:$$f_i((x,y)) = b_i$$The ##i##-th equation is satisfied by the level set ##S_{i}(b_i)##, ie the level set of ##f_i## on which ##f_i## gives value ##b_i##. Let's call that level set for equation ##i## the ##i##-th boundary line, because it will be a boundary of the triangle. On one side of that boundary line, ##f_i## will always give a value larger then ##b_i## and on the other side, always smaller.

For each ##i## we define ##P_{i}## to be the point of intersection for the two boundary lines that are not boundary line ##i##. Now the entire triangle lies on one side of that boundary line, or on the line, and ##P_i## is in the triangle but not on that boundary line. So the weak inequality (##\geq## or ##\leq##) version of equation ##i## that applies to ##P_i## must also be satisfied by all points in the triangle.
That is, if ##f_i(P_i)\leq b_i## then ##f_i(\mathbf v)\leq b_i## for all points ##\mathbf v## in the triangle. And the same applies if we replace ##\leq## by ##\geq##.

We test and find that:\begin{align*}
&f_1(P_1) = f_1((1.8, 0.8)) = 2\times 1.8+ 0.8 = 4.4\geq 2 = b_1\\
&f_2(P_2) = f_2((1,0)) = 2\times 1 + 3\times 0 = 2\leq 6 = b_2\\
&f_3(P_3) = f_3((0,2)) = 0 - 2 = -2 \leq 1 = b_3\\
\end{align*}For each ##i## the diagram shows as a dashed line the level set for ##f_i## that passes through point ##P_i##.

So our triangle is defined as:$$\Delta\,P_1P_2P_3 = \left\{ \mathbf v\in\mathbb R^2\ :\
f_1(\mathbf v)\geq b_1\wedge f_2(\mathbf v)\geq b_2\wedge f_3(\mathbf v)\geq b_3\right\} $$where ##\wedge## means AND.

We can then test and see that ##P## satisfies this but ##Q## and ##O## (the origin) do not.

PS the book's solution in post 15 is just a very terse - and somewhat hard to follow - version of this approach.

PPS below is some python code to automate the solution, showing it's quite straightforward and requires no diagrams to determine directions:
[CODE lang="python" title="Python code"]
import numpy as np

# matrix of coefficients from equations (LHS)
M = np.array([[2, 1],\
[2, 3],\
[1, -1]])
# vector of constants from equations (RHS)
b = np.array([2, 6, 1])

# function to choose the 'other two' indices, given an index i in [0, 1, 2]
def not_i(i):
return np.where(i == 0, [1, 2], np.where(i == 1, [0, 2], [0, 1]))

# function to test whether the i-th linear function gives > or < b at point (x,y)
def test_val(x, y, i):
return np.sign(sum(M * np.array([x, y])) - b)

# set up v to be matrix of coordinates of the three triangle vertices
v = np.array([[0.0 ,0.0],\
[0.0, 0.0],\
[0.0, 0.0]] )
# set up vector 'signs' to give directions of the inequalities
signs = [1, 1, 1]
# loop to find the vertices (points of intersection) and directions of inequalities
for i in [0, 1, 2]:
v[i, :] = np.linalg.solve(M[not_i(i)], b[not_i(i)])
signs = test_val(v[i, 0], v[i, 1], i)

# using the above, define a function to test whether point (x, y) is in the triangle
def is_in_triangle(x, y):
is_in = True
for i in [0, 1, 2]:
is_in = is_in and (test_val(x, y, i) == signs)
return is_in

# apply the function to test each of the three points
print("Is (1, 1) in the triangle? ", is_in_triangle(1, 1)) # test point P
print("Is (1, 2) in the triangle? ", is_in_triangle(1, 2)) # test point Q
print("Is (0, 0) in the triangle? ", is_in_triangle(0, 0)) # test point O (origin)
[/CODE]
And here is the output:
Code:
Is (1, 1) in the triangle?  True
Is (1, 2) in the triangle?  False
Is (0, 0) in the triangle?  False
 
Last edited:
  • Like
  • Love
Likes chwala, Lnewqban, PeroK and 1 other person
  • #44
Thanks very much for everyones contribution! I think I got it now.
 
  • Like
Likes berkeman and PeroK
Back
Top