Menu Close

for-128-x-127-and-127-y-128-where-x-y-Z-Point-P-x-y-is-a-point-on-the-cartesian-plane-From-the-origin-angle-is-made-counter-clockwise-with-the-positive-x-axis-1-How-many-uniqu




Question Number 12883 by FilupS last updated on 05/May/17
for     −128≤x≤127  and   −127≤y≤128  where   x,y∈Z     Point P(x,y) is a point on the  cartesian plane.     From the origin, angle θ is made counter  −clockwise with the positive x−axis.     (1) How many unique angles θ exist  if x,y∈P?  (2) Furthermore, how many unique  angles θ exist for the full range of x,y∈Z?
for128x127and127y128wherex,yZPointP(x,y)isapointonthecartesianplane.Fromtheorigin,angleθismadecounterclockwisewiththepositivexaxis.(1)Howmanyuniqueanglesθexistifx,yP?(2)Furthermore,howmanyuniqueanglesθexistforthefullrangeofx,yZ?
Answered by mrW1 last updated on 10/May/17
This is an interesting question.    We don′t neet to treat the case when  the points lie on the x− or y−axis,   the angles are  0° (x>0, y=0)  90° (x=0, y>0)  180° (x<0, y=0)  270° (x=0, y<0)    Let′s begin with the case when the  points lie in the first quadrant.  x=i ∈ P, y=j ∈ P  1≤i≤m  1≤j≤n    The angle θ for P(x,y) is defined by  tan θ = (y/x)=(j/i)  The number of unique angles is  the number of unique values of  (j/i) with 1≤i≤n and 1≤j≤m.    There are m×n points, we have also  m×n values of (j/i), but some of them  are not unique, e.g. points (2,3), (4,6)  have the same angle θ, since (3/2)=(6/4).    To find the number of unique values  of (j/i), we should simplify (j/i) to ((j′)/(i′)) with  i′ = ((LCM(i,j))/j) and j′ = ((LCM(i,j))/i), since  (j/i)=((LCM(i,j)×j)/(LCM(i,j)×i))=(((LCM(i,j))/i)/((LCM(i,j))/j))=((j′)/(i′))    e.g. for point (2,3): LCM(2,3)=6,  i′=(6/3)=2, j′=(6/2)=3, (j/i)=((j′)/(i′))=(3/2)  and for point (4,6): LCM(4,6)=12,  i′=((12)/6)=2, j′=((12)/4)=3, (j/i)=((j′)/(i′))=(3/2)    An other way to reduce the fraction (j/i)  to ((j′)/(i′)) is:  i′=(i/(GCD(i,j))) and j′=(j/(GCD(i,j)))  e.g. for point (2,3): GCD(2,3)=1,  i′=(2/1)=2, j′=(3/1)=3, (j/i)=((j′)/(i′))=(3/2)  and for point (4,6): GCD(4,6)=2,  i′=(4/2)=2, j′=(6/2)=3, (j/i)=((j′)/(i′))=(3/2)    For all points (i,j) with 1≤i≤m and  1≤j≤n, we can construct m×n values  of (j/i)=((j′)/(i′)).  Now we only need to count how many  of these values are unique.    It is difficult to give a general formula  for calculating the number of unique  values ((j′)/(i′)), but for concrete numbers  m and n, we can easily get the result  with help of Excel.    For m=10, n=20, for example, the  result is 127 unique angles, see fig.  in comment.    For m=127, and n=128, the result  is 9979 unique angles. But the table in  this case is too big to be shown here.
Thisisaninterestingquestion.Wedontneettotreatthecasewhenthepointslieonthexoryaxis,theanglesare0°(x>0,y=0)90°(x=0,y>0)180°(x<0,y=0)270°(x=0,y<0)Letsbeginwiththecasewhenthepointslieinthefirstquadrant.x=iP,y=jP1im1jnTheangleθforP(x,y)isdefinedbytanθ=yx=jiThenumberofuniqueanglesisthenumberofuniquevaluesofjiwith1inand1jm.Therearem×npoints,wehavealsom×nvaluesofji,butsomeofthemarenotunique,e.g.points(2,3),(4,6)havethesameangleθ,since32=64.Tofindthenumberofuniquevaluesofji,weshouldsimplifyjitojiwithi=LCM(i,j)jandj=LCM(i,j)i,sinceji=LCM(i,j)×jLCM(i,j)×i=LCM(i,j)iLCM(i,j)j=jie.g.forpoint(2,3):LCM(2,3)=6,i=63=2,j=62=3,ji=ji=32andforpoint(4,6):LCM(4,6)=12,i=126=2,j=124=3,ji=ji=32Anotherwaytoreducethefractionjitojiis:i=iGCD(i,j)andj=jGCD(i,j)e.g.forpoint(2,3):GCD(2,3)=1,i=21=2,j=31=3,ji=ji=32andforpoint(4,6):GCD(4,6)=2,i=42=2,j=62=3,ji=ji=32Forallpoints(i,j)with1imand1jn,wecanconstructm×nvaluesofji=ji.Nowweonlyneedtocounthowmanyofthesevaluesareunique.Itisdifficulttogiveageneralformulaforcalculatingthenumberofuniquevaluesji,butforconcretenumbersmandn,wecaneasilygettheresultwithhelpofExcel.Form=10,n=20,forexample,theresultis127uniqueangles,seefig.incomment.Form=127,andn=128,theresultis9979uniqueangles.Butthetableinthiscaseistoobigtobeshownhere.
Commented by mrW1 last updated on 07/May/17
Commented by mrW1 last updated on 07/May/17
this picture shows which (j/i) value is unique   and which is duplicate (yellow).
thispictureshowswhichjivalueisuniqueandwhichisduplicate(yellow).
Commented by FilupS last updated on 07/May/17
This is amazing! Thank you!
Thisisamazing!Thankyou!
Commented by mrW1 last updated on 11/May/17
Here the explanation how it works.    We have:  (j/i)=((j′)/(i′))  with i′=((LCM(i,j))/j) [or (i/(GCD(i,j)))]  j′=((LCM(i,j))/i)  [or (j/(GCD(i,j)))]    For each point (i,j) it can be one of  following two cases:    Case 1:  i′=i and j′=j  ⇒point (i,j) descripts a new angle.  e.g. point (2,7):  LCM(2,7)=14  i′=((14)/7)=2=i  j′=((14)/2)=7=j  ⇒point (2,7) has a new angle.    Case 2:  i′<i and j′<j  ⇒point (i,j) descripts no new angle,  its angle is the same as for point(i′,j′).  e.g. point (8,20):  LCM(8,20)=40  i′=((40)/(20))=2<i=8  j′=((40)/8)=5<j=20  ⇒point (8,20) has no new angle, since  it has the same angle as point (2,5).    Case 1 means also GCD(i,j)=1.  Case 2 means also GCD(i,j)>1.
Heretheexplanationhowitworks.Wehave:ji=jiwithi=LCM(i,j)j[oriGCD(i,j)]j=LCM(i,j)i[orjGCD(i,j)]Foreachpoint(i,j)itcanbeoneoffollowingtwocases:Case1:i=iandj=jpoint(i,j)descriptsanewangle.e.g.point(2,7):LCM(2,7)=14i=147=2=ij=142=7=jpoint(2,7)hasanewangle.Case2:i<iandj<jpoint(i,j)descriptsnonewangle,itsangleisthesameasforpoint(i,j).e.g.point(8,20):LCM(8,20)=40i=4020=2<i=8j=408=5<j=20point(8,20)hasnonewangle,sinceithasthesameangleaspoint(2,5).Case1meansalsoGCD(i,j)=1.Case2meansalsoGCD(i,j)>1.
Commented by mrW1 last updated on 08/May/17
Commented by mrW1 last updated on 08/May/17
Commented by mrW1 last updated on 09/May/17
Now we create a table with m columns  (for i=1 to m) and n rows (for j=1 to n).    We give the cell (i,j) the value 1 if it is  case 1 and the value 0 if it is case 2.    In Excel you can do this by entering  following formula into the first cell,  let′s say it is B5:  =1−SIGN(GCD($A5,B$4)−1)  and then copy this cell to all cells of the   table.    In this way we get a table like this:
Nowwecreateatablewithmcolumns(fori=1tom)andnrows(forj=1ton).Wegivethecell(i,j)thevalue1ifitiscase1andthevalue0ifitiscase2.InExcelyoucandothisbyenteringfollowingformulaintothefirstcell,letssayitisB5:=1SIGN(GCD($A5,B$4)1)andthencopythiscelltoallcellsofthetable.Inthiswaywegetatablelikethis:
Commented by mrW1 last updated on 08/May/17
Commented by mrW1 last updated on 09/May/17
Cells with value 1 have unique (j/i) and  cells with value 0 are duplicates.    The sum of all values in this table is  the number of unique angles for  1≤i≤m and 1≤j≤n.
Cellswithvalue1haveuniquejiandcellswithvalue0areduplicates.Thesumofallvaluesinthistableisthenumberofuniqueanglesfor1imand1jn.
Commented by mrW1 last updated on 09/May/17
From this table you can easily get the  number of unique angles for any   number of points, e.g. 7×22 points.
Fromthistableyoucaneasilygetthenumberofuniqueanglesforanynumberofpoints,e.g.7×22points.
Commented by mrW1 last updated on 09/May/17
Commented by mrW1 last updated on 09/May/17
The big question now is:  is it possible to find a formula to  calculate the number of unique angles  for m×n points?
Thebigquestionnowis:isitpossibletofindaformulatocalculatethenumberofuniqueanglesform×npoints?
Commented by FilupS last updated on 09/May/17
This is fascinating!
Thisisfascinating!
Commented by FilupS last updated on 09/May/17
Creating a formula for LCM(i,j)  wouldn′t be very straight forward.    It would be extremely difficult and possibly  involve prime number distributions,  which is going into number theory and  the prime numbers
CreatingaformulaforLCM(i,j)wouldntbeverystraightforward.Itwouldbeextremelydifficultandpossiblyinvolveprimenumberdistributions,whichisgoingintonumbertheoryandtheprimenumbers
Commented by FilupS last updated on 09/May/17
The best function I can think of would  be something like (correct if wrong):  i′=((LCM(i,j))/j)       j′=((LCM(i,j))/i)  δ_(ij) = { ((1     ⇔     i′=i  ∧  j′=j)),((0     ⇔     i′<i  ∧  j′<j)) :}  Φ=Σ_i ^m Σ_j ^n δ_(ij)      Φ=total unique angles
ThebestfunctionIcanthinkofwouldbesomethinglike(correctifwrong):i=LCM(i,j)jj=LCM(i,j)iδij={1i=ij=j0i<ij<jΦ=minjδijΦ=totaluniqueangles
Commented by mrW1 last updated on 09/May/17
I agree with you.    We can write:  δ_(ij) =1−sign(i−((LCM(i,j))/j))  ⇒Φ=Σ_(i=1) ^m Σ_(j=1) ^n δ_(ij)   ⇒Φ=mn−Σ_(i=1) ^m Σ_(j=1) ^n sign(i−((LCM(i,j))/j))
Iagreewithyou.Wecanwrite:δij=1sign(iLCM(i,j)j)Φ=mi=1nj=1δijΦ=mnmi=1nj=1sign(iLCM(i,j)j)
Commented by FilupS last updated on 09/May/17
I think thats the best solution!
Ithinkthatsthebestsolution!
Commented by mrW1 last updated on 09/May/17
An other simple formula is:  δ_(ij) =1−sign(GCD(i,j)−1)  Φ=mn−Σ_(i=1) ^m Σ_(j=1) ^n sign(GCD(i,j)−1)
Anothersimpleformulais:δij=1sign(GCD(i,j)1)Φ=mnmi=1nj=1sign(GCD(i,j)1)
Commented by FilupS last updated on 09/May/17
can you explain how you got this?
canyouexplainhowyougotthis?
Commented by mrW1 last updated on 10/May/17
(j/i)=((j′)/(i′))=((j/(GCD(i,j)))/(i/(GCD(i,j))))  when i′=i and j′=j, it means (j/i) can  not be simplified any more, i.e.  GCD(i,j)=1. E.g. for point (2,7):   GCD(2,7)=1, (7/2) is a fraction which  is already simplified to lowest terms.    when i′<i and j′<j, it means (j/i) can  be simplified further, i.e. GCD(i,j)>1.  E.g. for point (8,20): GCD(8,20)=4,  ((20)/8) can be simplified to ((20/4)/(8/4))=(5/2).    if GCD(i,j)=1,    ⇒1−sign(GCD(i,j)−1)=1 ⇒ unique  if GCD(i,j)>1,   ⇒1−sign(GCD(i,j)−1)=0,⇒ duplicate
ji=ji=jGCD(i,j)iGCD(i,j)wheni=iandj=j,itmeansjicannotbesimplifiedanymore,i.e.GCD(i,j)=1.E.g.forpoint(2,7):GCD(2,7)=1,72isafractionwhichisalreadysimplifiedtolowestterms.wheni<iandj<j,itmeansjicanbesimplifiedfurther,i.e.GCD(i,j)>1.E.g.forpoint(8,20):GCD(8,20)=4,208canbesimplifiedto20/48/4=52.ifGCD(i,j)=1,1sign(GCD(i,j)1)=1uniqueifGCD(i,j)>1,1sign(GCD(i,j)1)=0,duplicate
Commented by mrW1 last updated on 10/May/17
I didn′t expect that the solution could be  expressed in such a simple formula,  eventhough it is no formula with  which one can directly get the result.    Thank you for this interesting and  challenging question. To solve it  has made a lot of fun.
Ididntexpectthatthesolutioncouldbeexpressedinsuchasimpleformula,eventhoughitisnoformulawithwhichonecandirectlygettheresult.Thankyouforthisinterestingandchallengingquestion.Tosolveithasmadealotoffun.
Commented by FilupS last updated on 10/May/17
Thank you for solving it
Thankyouforsolvingit

Leave a Reply

Your email address will not be published. Required fields are marked *