# Algorithm problem involving 3 points and 3 lines in the x,y plane

• sHatDowN
If they differ by a multiple of ##\pi##, then C is not on the line through A and B.So you can use the atan2() function I mentioned in a previous post to determine the angle from the origin to each of the lines. You don't even have to compute the angles if all you're interested in is whether or not the line from A to C is the same as the line from A to B. Just compare the slopes of the lines.
sHatDowN
Poster has been reminded (again) to show their work on schoolwork problems
Homework Statement
ArcTan Algorithm
Relevant Equations
Need to know how to implement arctan in algorithm
1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?

sHatDowN said:
Homework Statement:Algorithm
Relevant Equations: Algorithm

how to implement this algorithm?
Make a sketch

And find the exact problem statement. Not just the word algorithm

##\ ##

berkeman
It's my idea :
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm

sHatDowN said:
1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
I think I understand what you're asking, but it's unclear. A better description would be: Calculate the angle between two lines that pass through the origin and points A and B.
sHatDowN said:
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)
Also unclear. Are the coordinates of point C given? There are an infinite number of lines that pass between points A and B. Without more information, I don't think this is solvable.
sHatDowN said:
how to implement this algorithm?
You're not implementing an algorithm -- you're attempting to solve a very vaguely defined problem.

sHatDowN said:
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm
It's not clear to me what, if anything, the arctangent has to do with the problem you're trying to solve.

sHatDowN said:
It's my idea :
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm
You should become familiar with the problem of arctan(y/x) when it is not true that both y and x are positive. The problem is that arctan(y/x) = arctan(-y/-x) and arctan(y/-x) = arctan(-y/x), so arctan(y/x) is not a very simple indicator of the angle of a radial line from the origin. You would need to do a lot of additional checking about the signs of x and y.
In computer program languages this problem is greatly simplified by the function atan2( y, x). It accounts for the signs of the inputs correctly.
All angles are in radians, ##r##, where ##-\pi \lt r \le \pi##.
atan2( y1, x1) would give you the counterclockwise angle from the positive X-axis to the line (0, A). (Negative radians is going clockwise)
Similarly, atan2( y2, x2) would give you the counterclockwise angle from the positive X-axis to the line (0, B).
Can you use that to solve the problem?

Last edited:
sHatDowN said:
Homework Statement:: ArcTan Algorithm
Relevant Equations:: Need to know how to implement arctan in algorithm

1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?
Are you asking to show whether or not (x3,y3) lies on a line between (x1,y1) and (x2,y2)?

This is algebra.

sHatDowN said:
Homework Statement:: ArcTan Algorithm
Relevant Equations:: Need to know how to implement arctan in algorithm

1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?
By definition in 2 dimensional euclidean geometry, a line that passes between two points will intersect with the line defined by them. You've only given one point for the intersecting line, so ...

For part 2, if the angle of the line from A to B differs from the angle of the line from A to C by a multiple of ##\pi##, then C is on the line through A and B.

## 1. What is an algorithm?

An algorithm is a set of step-by-step instructions or rules that a computer or person can follow to solve a problem or complete a task.

## 2. How is an algorithm used in a problem involving 3 points and 3 lines in the x,y plane?

In this problem, an algorithm can be used to determine the intersection points of the lines and the distances between the points. It can also be used to find the equations of the lines and the coordinates of any other relevant points.

## 3. What are the key components of an algorithm for this problem?

The key components of an algorithm for this problem would include identifying and labeling the points and lines, determining the equations of the lines, finding the intersection points, and calculating the distances between the points.

## 4. Can an algorithm be used to solve similar problems with different numbers of points and lines?

Yes, an algorithm can be adapted and used to solve similar problems with different numbers of points and lines. The key components and steps of the algorithm would remain the same, but the specific calculations and equations would change based on the given information.

## 5. Are there any limitations to using an algorithm for this type of problem?

One limitation of using an algorithm for this type of problem is that it assumes the points and lines are in a two-dimensional x,y plane. If the problem involves points and lines in a different plane or in three dimensions, the algorithm may need to be modified. Additionally, the accuracy of the solutions may be affected by the precision of the calculations and the accuracy of the given information.

• Precalculus Mathematics Homework Help
Replies
17
Views
955
• Precalculus Mathematics Homework Help
Replies
8
Views
1K
• Precalculus Mathematics Homework Help
Replies
2
Views
882
• Precalculus Mathematics Homework Help
Replies
6
Views
2K
• Precalculus Mathematics Homework Help
Replies
17
Views
1K
• Precalculus Mathematics Homework Help
Replies
2
Views
1K
• Precalculus Mathematics Homework Help
Replies
3
Views
2K
• Precalculus Mathematics Homework Help
Replies
20
Views
2K
• Precalculus Mathematics Homework Help
Replies
18
Views
522
• Precalculus Mathematics Homework Help
Replies
24
Views
2K