Results 1 to 22 of 22

Thread: Line crossing X question

  1. #1

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Line crossing X question

    Hi all,

    I have 2 questions that are roughly the same thing


    1) if i take a number lets say 44. is there an easy way to pick two random points along a random line ( i guess random slope of a line since it has to go through 44)


    2) what is the equation for taking two points x1,y1 and x2,y2 and resolving the X intersect out of it ( probably much easier)


    Thanks

    Robert

  2. #2

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    The idea behind it is

    that lets say 44 is a password

    if i run a random line that passes throgh x at 44 and take two random points on that line

    i give one guy one set of points x1,y1

    and another guy the other set x2,y2

    and there is no way that just one can figure out what the password is unless they talk to each other.

    or i keep on set hidden and give one to another party in the event of my death the two will talk and get the password use your imagination

    obvouisly the point would have to be much larger than 44 but the theory seems sound

  3. #3
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    if i run a random line that passes throgh x at 44
    What shall this tell us? What are the coordinates for this point? (x= 44; y=???)

    Even if you have the coordinate data for both points, how will you decide which point on the connecting line will be your "password", if you only look for an x-value?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    im not sure i have conveyed my point properly

    i don't need to know what y is it doesn't matter


    lets say we use your pin number for the atm 3498(just makeing it up obviously)

    so to "split" the pin in two so that no one person can figure it out on there own we would:

    1) make X= 3498
    2) draw a line with a random slope through X
    3) take two( or more) random points from that line

    4) give person 1 points 45,23 and person two -12,34 (agian just makeing it up)


    to decode

    they two meet up and input there coordinates and it draws a line
    the line passes X at point 3498 and VOLA they have the password


    now obviously you wouldn't want to use this for your pin i jsut used it as an example but it would be nice at work if you had a system that one department is not supposed to access with out a member of a diffrent department.

  5. #5
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    Maybe I'm stupid, but how do do calculate the X out of those two other numbers??
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    Slope m = (Y2-Y1)/(X2-X1)

    Take the equation y = m x + b

  7. #7

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    I guess the idea needs to be broken down into two sub ideas


    1) How can i "draw" a line that intersects x at a given value

    2) How can i get x, y coronate values from a line

  8. #8
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    Question 2 is easily answered:
    Using the formula y=ax +b, you can calculate y for any value of x. But that's the problem I have with your approach, you need an x-value to look for the correspondent y-value, or vice versa.
    The approach to start with an x-value and then draw a "random" slope thru the point (a point has a x and y-values!) doesn't make sense to me!

    The decoding approach is also unclear, you have two points from this line, but you save only one value for each of those points
    (
    give person 1 points 45,23 and person two -12,34
    )
    There is no way to calaculate anything out of two x-values if you don't have the y-values!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  9. #9

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    sorry must be a American thing


    give person 1 points 45,23 and person two -12,34

    x45, y23
    x-12, y23

  10. #10
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    OK, that solves one problem, but how could you calculate out of those two points your desired x value, in my opinion you need an y value for that!

    You have:
    x1 = 45, y1 = 23
    x2 = -12, y2 = 34
    that makes this line-equation:
    m = (Y2-Y1)/(X2-X1)= (34- 23)/ (-12 -45) = 11/ -57 = -0.19....

    y = -0.19...x + b
    23 = -0.19....(45) +b
    b= 31.68....

    y=0.19..x +31.68... is your formula.

    Just tell me how to get a value for x, without giving a value for y!
    Last edited by opus; May 14th, 2007 at 05:38 AM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  11. #11
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: Line crossing X question

    Quote Originally Posted by Crash893
    2) what is the equation for taking two points x1,y1 and x2,y2 and resolving the X intersect out of it ( probably much easier)
    You would need the slope used for each point (2 different slope values). Once you have that, you could create two slope point equations and set them equal to find the intersection(s).

    Just given 2 different points doesn't help. You could create a formula, but there would be like 2 unknowns!


    I don't know, maybe I'm just over-complicating things.

  12. #12

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    sorry im not good at explaining these thing i dont understand them that well my self


    you are only trying to solve for where this line cross's X

    X=??? y=0

  13. #13

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    to decode

    answer = (((X2 - X1)*(0 - Y2)) / (Y2 - Y1)) + X2;

  14. #14
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    Now you are coming clear, your X is not a point it is the horizontal vertex! In this case y is given to be 0 all the time!
    Let me rephrase yopur problem:
    You have a number that needs to be secret.
    You want to create two seperate coordinates (set of two numbers) that would together specifiy the secret number, but would be useless on their own.

    To create the two seperate coordinates you use a random slope (m) thru the coordinate x = The secret Number and y = 0. (formula y = mx +b ). The value for the additon (b) can be calculated like:
    b= - mx
    NOTE: m<>0!

    Having this formula, you can select two random x-values, for those you can calculate the corresponding y-values. You have your seperate coordinates now.

    With one coordinate alone, nothing could be computed, using both the value of the secret number is easily computed.

    The calculation:
    Starting with x1, y1 and x2, y2

    calculate Slope(m)
    m = (y2 - y1) / (x2 - x1)

    calculate b:

    b = y1 - m*x1 or b = y2 - m*x2

    calculate the secret number (X), remeber Y is always 0:

    0 = m*X +b
    X = -(b/m)

    X =-( (y1 - (y2 - y1)/(x2 - x1)*x1) / ((y2 - y1)/(x2 - x1)))

    X = -(y1 / ((y2 - y1)/(x2 - x1)) + ((y2 - y1)/(x2 - x1)*x1)/((y2 - y1)/(x2 - x1))

    X = x1*(((y2 - y1)/(x2 - x1))/((y2 - y1)/(x2 - x1))) - (y1 / ((y2 - y1)/(x2 - x1))

    X = x1 - (y1 / ((y2 - y1)/(x2 - x1))

    For example:
    Secret Value X =1234

    Random Slope(m) = 23

    Addition (b)= -28382

    Random values for x1= 1000 and x2=-500

    Calculate y1= -5382 and y2= -39882

    Recalulation of X
    X = x1 - (y1 / ((y2 - y1)/(x2 - x1))
    X = 1000 - (-5382 / ((-39882--5382)/(-500-1000)) = 1234

    Although this example came up with integer values only, you have to expect non-integer values for the y1 and y2 values!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  15. #15

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    wow

    thanks

    yea im not a mathy type person so some times i have trouble explaining what im trying to do


    also there is a version of this idea that uses porabola's

    where 3 cordnates are given to solve for x

  16. #16
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    If your question is answered, please use the thread tools to mark this thread as resolved (I'd suggest to start a new threat if you need help with this parabola thing).
    And you might give aweay a positve rating to a person that did help you;-)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  17. #17

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    rateings away!

    however i still havent had a chance use all the info in this tread yet

    when im done it will be resolved

  18. #18
    New Member
    Join Date
    May 2007
    Posts
    3

    Re: Line crossing X question

    I might be wrong, and I haven't read all the replies, but if you just give two people two points on the line, then your hidden number can still be any one of an infinite number of points on this line segment, can't it? You'd need two separate equations for lines such that they intersect at 44.

  19. #19
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Line crossing X question

    Quote Originally Posted by hippolyta
    I might be wrong, and I haven't read all the replies...
    Somewhere down the road, he made clear that his secret value is a coordinate like (x; 0). With that information, the problem is easy to solve!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  20. #20

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    Just fyi here is the code that i've kinda of got workign

    It works out to a point i am still having trouble working with larger numbers that i will need for it to work in the wild but now simple 15 digit numbers work fine.


    Encryption
    c# Code:
    1. Random random = new Random();
    2.           double X1, X2, X3, Y1, Y2, Y3;
    3.           //STEP3 MAKE RANDOM PNT1
    4.           X1 = random.Next(2,100);
    5.           Y1 = random.Next(2,100);
    6.  
    7.           //STEP2 MAKE PNT2 WITH CONSTANT ( FROM TEXT BOX)
    8.           X2 = Convert.ToDouble(textBox7.Text);
    9.           Y2 = 0;
    10.  
    11.           //X3 = 1;
    12.           //Y3 = 1;
    13.  
    14.           //STEP4 GET SLOPE FROM PNT1 AND PNT2
    15.           double slope = (Y2 - Y1) / (X2 - X1);
    16.           double t = random.Next(2,100);
    17.           double b = Y1 - slope * X1;
    18.  
    19.  
    20.           //STEP5 GET RANDOM POINT ALONG LINE MADE PNT1 AND PNT2
    21.           X3 = random.Next(100);
    22.           Y3 =  slope * X3 + b;
    23.          
    24.  
    25.  
    26.           //float p = random.Next(1);
    27.           //  X3 = X1+(1-p)*X2;
    28.           //  Y3 = p * Y1 + (1 - p) * 2;
    29.  
    30.           //OUTPUT TO TEXTBOX
    31.           textBox5.Text = t.ToString();
    32.           textBox6.Text = slope.ToString();
    33.  
    34.           textBox1.Text = X1.ToString();
    35.           textBox2.Text = Y1.ToString();
    36.  
    37.           textBox3.Text = X2.ToString();
    38.           textBox4.Text = Y2.ToString();
    39.  
    40.           textBox9.Text = X3.ToString();
    41.           textBox8.Text = Y3.ToString();


    Decryption
    c# Code:
    1. double X1, X2,  Y1, Y2, answer;
    2.        
    3.      
    4.            
    5.             X1 = Convert.ToDouble(textBox15.Text);
    6.             Y1 = Convert.ToDouble(textBox16.Text);
    7.             X2 = Convert.ToDouble(textBox10.Text);
    8.             Y2 = Convert.ToDouble(textBox11.Text);
    9.  
    10.             answer = (((X2 - X1) * (0 - Y2)) / (Y2 - Y1)) + X2;
    11.  
    12.         textBox12.Text = Convert.ToDouble( answer).ToString();

  21. #21
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Line crossing X question

    I might not understand entirely, but is the user given the two random coordinates or is there any way for him to extract them?
    If so, they could just try 2 times, get 2 different lines both times... the point where these lines will interesect will be your password, no? Easy to find then!

  22. #22

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    Re: Line crossing X question

    no

    1 set = random

    2set = random along the line


    you only give 1 set to each party
    Last edited by Crash893; Jan 22nd, 2008 at 07:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width