Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How do you solve for the intersection of a line and a cosine function?

  1. Dec 1, 2005 #1
    Suppose you are given the equation of a line, and a given cosine function that the line intersects. How do you solve algebraically, that is non-graphically, for the point of intersection of the line and the cosine function?


  2. jcsd
  3. Dec 1, 2005 #2
    So you want to solve m*x + b = A*cos(B*x + C) + D, which simplifies to E*x + F = cos(B*x + C).
    Since cosine is transcendental, you will have to employ arccosine or the natural logarithm. You can also use the analytic series or Newton-Raphson, etc. to approximate x. Luckily, you need only look at x in the interval [(-1-F)/E,(1-F)/E].
    Last edited: Dec 1, 2005
  4. Dec 1, 2005 #3
    Can you give me some specific examples on how I might use one of the four methods you mentioned above to solve an equation of the form

    cos(f(x)*pi) - cos(pi*x) = mx + b?

    Where f(x) is some function of x, pi is the number pi, and mx +b is the equation of the line that intersects the cosine function.

    1) How would I use an analytical method to solve this?

    2) How would I use the Newton Raphson method to solve this?

    3) How would I use a natural logarithm to solve this?

    I don't think I could apply an arccosine in this particular case unlike the case first mentioned above.

    If you could give me a reference on the internet where I could look up the answers to the questions 1 through 3 above, that would be much appreciated.

    Thanks for the help!

    Best Regards,

  5. Dec 2, 2005 #4
    An approximation method like Newton-Raphson seems to be the only manageable way to get a solution for that equation. You can find the method explained http://planetmath.org/encyclopedia/NewtonsMethod.html [Broken].
    Last edited by a moderator: Apr 21, 2017 at 10:09 PM
  6. Dec 3, 2005 #5
    With a neatly drawn graph, you can get an idea of the number of solutions and even the intervals where they lie making search easier. First of all, for something like [itex]\cos x = Ax + B[/itex], a solution exists only if the right hand side lies between -1 and +1. Since the linear function is unbounded, this means solutions can exist only in some interval(s). You are probably interested in solving more complicated systems like [itex]\cos(f(x)) = Ax + B[/itex] but the basic idea remains the same. Depending on the nature of f(x), the slope [itex]\frac{-A}{B}[/itex] and the y-intercept [itex]B[/itex] it may be possible to estimate the number of solutions. A trivial example is something like [itex]y = k[/itex]. For solutions to exist, we must have [itex]|k| \leq 1[/itex].
  7. Dec 3, 2005 #6
    I've done it iteratively before like for solving x = cos x.

    I start off with a arbitarty number say x=.5. I take the cosine of it. Then I take the cosine of the output, and then the cosine of that output, and then the cosine of that output.... You stop when you notice the values stop changing.
  8. Dec 3, 2005 #7
    Thankyou! Taking your advice I propose then the following:

    Consider the composite number C that is composed of 2 odd prime numbers a and b.

    The following are one of two functions that have vertical asymptotes at plus and minus one, plus and minus the composite number C, and plus and minus the the prime numbers of any given composite C composed of two odd prime numbers x=a and x=b, that is C = a*b, where "a" and "b" are odd prime numbers.

    f(x) = {1/(cos(k*x/2 + k*C/(2*x)) + cos(k*x) + 2) if (C+1)/2 is odd}

    f(x) = {-1/(cos(k*x/2 + k*C/(2*x)) - cos(k*x)-2) if (C+1)/2 is even}

    Where k is the constant pi, which is approximately equal to 3.141592654.

    Your idea is to graphically determine a range that the solution to the equation exist within. What would be nice is to find a broad range, and then be able to narrow the range quickly.

    For the case where (C + 1)/2 is an even integer, the following function might suffice.

    f(x,y) = x*y - (-1/(cos(k*x/2 + k*C/(2*x)) - cos(k*x) - 2)),

    Where {2<x<C}

    There exists a vertical asymptote where this function tends to negative infinity at the prime factors of C (also at plus and minus C and plus and minus 1).

    Where y is between 0 and 1.

    For y near 0, the function is negative for almost all x between x = 0 and x = C.

    For y near 1, the function is only negative on the following intervals:



    Where a and b are the prime factors of C!

    This means that if we start with y near 0, we can determine a range of values where the function above is negative, our prime factors exist in this range. Then to narrow the range, we increase y in managable increments towards 1, and narrow our range over which the function is negative. The result intervals over which the function is negative quickly narrows to within plus or minus 1 of our prime factors! A similar function can be derived for the case when (C+1)/2 is an odd integer!

    One might be able to write up a computer program that can factor large composites C composed of two odd prime numbers, a and b!

    Does this seem like it will work? Can you say RSA challenge numbers?

    Ah, it's got to be to good to be true.


    Last edited: Dec 3, 2005
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: How do you solve for the intersection of a line and a cosine function?