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

Contour Integral explanation

  1. Jan 25, 2010 #1

    Char. Limit

    User Avatar
    Gold Member

    I saw a contour integral in a text I was recently reading, but unfortunately a contour integral is beyond my understanding at the moment. As such, I would greatly appreciate it if someone could explain a contour integral to me.

    If it helps, I know about derivatives, integrals, partial derivatives, gradients, divergences and curls, and a bit on differential equations.
  2. jcsd
  3. Jan 25, 2010 #2
    Was it a contour integral over a scalar field or a vector field?
  4. Jan 25, 2010 #3
    I'm sure someone will be able more detailed answers than I, but I just want to quickly give an outlook. You also know about complex numbers?

    Do you know about the divergence theorem?
    Basically contour integrals are used like a 2D divergence theorem. Instead of integrating on a curve over a contour in the complex plane you can sum over some "divergence" of the interiour to get the same result. The trick is that for most "reasonable" functions this divergence is zero at all points except for the points with singularities (like where you'd divide by zero). So you could
    1) without changing the value of the contour integral deform the contour as you wish, as long you keep the relevant singularities inside the contour
    2) calculate the contour integral by summing over the contributions of the singularities only to get the its value

    You usually integrate over a closed loop in the complex planes.
    So you write
    [tex]\oint f(z)dz[/tex]
    and mean the you go over all values for z on the given path in the complex plane. For example try integrating
    [tex]\oint z^2dz=\int_0^1 zdz+\int_1^{1+i} zdz+\int_{1+i}^{i} zdz+\int_i^0 zdz[/tex]
    from z=0 to z=1 to z=1+i to z=i back to z=0 (which is a square in the complex plane). You should get zero.
    Now try integrating
    [tex]\oint \frac{1}{z}dz[/tex]
    from z=-1-i to z=1-i to z=1+i to z=-1+i back to z=-1-i which is a square about the origin. You could use any other square or arbitrary contour, but as long as you include the origin you will always get the same result for the contour integral. As I said, instead of integrating over the contour you could just sum over the contributions for singularities inside the contour. The function 1/z has only one such contributing singularity at the origin. Maybe you can make sense of

    Contour integrals are usually used to calculate normal integrals from [itex]-\infty[/itex] to [itex]+\infty[/itex]. In the first step you look at it in the complex plane. The normal integral is the integral along the real axis. Now you add a half-circle of infinite radius above this real axis to form a big closed "half-circle" contour. For the practical cases the half-circle you added has a vanishing contribution for a half-circle of infinite radius. Therefore we equal contour integral and normal integral.
    Now we know that to calculate a closed curve integral, all we need is to sum over the residues (contributions from singularities inside). Therefore we effectively calculate the normal infinite integral we needed in the first place.

    OK, maybe someone else continue from here. Or just ask questions :)
  5. Jan 27, 2010 #4
    I'll briefly summarize you the theory of calculating such integrals. I guess you're talking about integrals of real fields rather than complex functions, so I'll talk about real integration (which is pretty much like complex integration)

    A contour integral is a generalization of the "normal" integral, which is integration over the line segement which contained in the x-axis. To extend this, you need to introduce functions of several variables (scalar fields or vector fields) and its sufficient to do this on a two-dimensional case.

    1. Contour Integral of The First Kind

    You have a scalar field f(x,y), which represents some distribution, let's say of mass. You'd like to calculate the total mass on a wire which is your contour [tex]\gamma[/tex]. Observe that a contour is a pair of two functions x(t) & y(t) which accepts a variable a<=t<=b and describe a set of points creating the contour. (x(t),y(t)) is called the parametrization. Each contour has infinitely many parametrizations, and you can do the same with polar coordinates or any legitimate coordinates you'd like to choose. But we'll stick to the cartesian parametrization (also the differentials change when considering other coordinate systems).

    You'd like, like in normal integrals, to slice up your contour into really small peaces, evaluate the field at an arbitrary point in the peace, multiply by the length, and sum over all of them. Then you do a limiting process to get a smooth summation.
    It can all be done by Reimann Sums but i'll skip this. The important things are that the differential length of the curve at each points can be given formally by the pithagorean theorem: (as the peaces go to zero-length, they approach straight lines)


    Integration is denoted by [tex]I=\int_{\gamma}f(x,y)ds[/tex]
    By change of variables, it reduces to a simple one-dimensional integration:

    (Here dot denotes derivation wrt t)

    The integrand here is only a function of t, and your integrate wrt t so you ought to get a numerical result (independent of x,y or t).
    The trick here is to get a good parametrization so that your integral will be simple.

    A good result from that, is that a length of the curve can be simply calculate by letting f(x,y)=1 and then


    Of course notice that the result of the integration must be independent of the parametrization you've chosen to work with (otherwise you've done things wrong).

    2. Contour Integral of the Second Kind

    This is the equivalent of physical work definition. Here instead of a scalar field (that might represent mass, electric charge), you have a vector field (might represent electric field, gravitational force), and you'd like to calculate it's "effective impact" across some contour [tex]\gamma[/tex].

    So you have

    (i & j are the unit vectors in the direction of x & y)

    And a parametrization


    Effective impact means that at each differential slice of the curve, you collect the component of the field which is parallel to the curve. The tangent of the curve is:


    And therefore the parallel component\the projection is given by:


    The notations of the integral are:


    And by a similiar change of variables you get:


    Which is again a simple integral wrt t.

    P.S. I worked under the assumptions that your contours are smooth enough. Notice that some contours are not smooth, and may be defined only piecewise.
    You can also use the fact that integrals are additive: the integral over a contour which is made of two contours united together, is the sum of integrals over each contour seperately.

    Also, there's the matter of direction. In the first kind, direction doesn't matter, since we are talking about scalars. Of course [tex]\int^{t=b}_{t=a}=-\int^{t=a}_{t=b}[/tex] But if you've chosen to start integrating from t=b, then your parametrization must change also, keeping the integral itself unchanged.

    In second kind integration, direction is important (it alters the result by a minus sign) so you must know from where to where you perform the integration.

    And finally, once you've done the leap from one to two dimensions, you'll probably easily understand how to generalize to 3,4 and n-dimensions.

    I hope I've helped, yet I think a more rigorous establishment (justifying all change of variables) will be in literature rather than in here.
  6. Jan 27, 2010 #5

    Char. Limit

    User Avatar
    Gold Member

    All right, I think I get it. I'd like just one more thing: a simple example of each. Perhaps put the solution in spoilers so that I can try to work it out first?
  7. Jan 27, 2010 #6
    For the first kind, try to compute the integral of x^2+y^2 over the unit circle (the circle with center (0,0) and radius 1).
  8. Jan 28, 2010 #7
    For the second kind try calculating the integral of the field

    Over the unit circle counter-clockwise (remember that direction is important?)

    This is an interesting vector field :)
  9. Jan 28, 2010 #8

    Char. Limit

    User Avatar
    Gold Member

    So far, I'm having difficulty with one part of this. I figured that the parametrization of the unit circle is:

    So... here's what I've done...

    [tex]\int_0^{2\pi} f(cos(t),sin(t))\sqrt{(-sin(t))^2+(cos(t))^2}dt[/tex]

    That radical should reduce to one. So, do I do this?

    [tex]\int_0^{2\pi} cos(t)^2+sin(t)^2 dt = \int_0^{2\pi} dt[/tex]

    But that just equals 2pi. The answer seems too simple, I must have done something wrong.
  10. Jan 28, 2010 #9
    2 pi is correct.

    What about x^2 + 2*y^2?
  11. Jan 28, 2010 #10

    Char. Limit

    User Avatar
    Gold Member

    Over the same contour?

    First, I can see the usefulness of working with the unit circle. Getting rid of half of the problem... good idea.

    So, the integral will go out to 1+cos^2(x)...

    Let's see what we can do...
    Cosine squared of a number is equal to sine squared of a number minus twice the number...


    which equals


    which simplifies to

    .5 -1.5cos(2x)

    So, the integral of that is


    which from zero to 2pi is...

    just pi. Right?
  12. Jan 28, 2010 #11
    No. The answer should obviously be greater than 2 pi.
  13. Jan 28, 2010 #12

    Char. Limit

    User Avatar
    Gold Member

    Where did I go wrong?
  14. Jan 28, 2010 #13
    Simple arithmetical error. .5 -1.5cos(2x) should be 1.5 -1.5cos(2x).

    Here's how you can get the same results without any trigonometry at all.

    The first integral is of a function that is constant along the entire contour. So, its value is just the value of the function (1) times length of the contour (2 pi).

    Symmetry tells us that [itex]\oint x^2 dl = \oint y^2 dl = 1/2 \oint (x^2+y^2) dl = \pi[/itex].

    Therefore [itex]\oint (x^2+2y^2) dl = \pi + 2\pi = 3\pi[/itex].
  15. Jan 28, 2010 #14

    Char. Limit

    User Avatar
    Gold Member

    Oh my god, I can't believe I made that error.

    So, in general, the contour integral for [tex]ax^2+by^2[/tex] with the contour being the unit
    circle is equal to [tex](a+b)\pi[/tex]?
  16. Jan 29, 2010 #15

    Char. Limit

    User Avatar
    Gold Member

    OK, so I think I get the first kind of contour (line, path) integral. The second kind is confusing me though. How do you parametrize a vector?
  17. Jan 30, 2010 #16
    You parametrize the curve like in the first kind (in both kinds the parametrization will be off course identical for the same curve).

    But instead of taking the differential length of the curve, you now need to take the differential direction of the curve=the tangent vector.

    if your curve is parametrized by (x(t),y(t)) then at each point the tangent vector will be


    Now at each point you need to take the dot product of the vector field you're integrating, with the tangent direction. So you integral is

    (Here F(x,y)=( P(x,y), Q(x,y) ))
    Now you need to change variables. From (x,y) to (x(t),y(t)) and what you get is


    And simply integrate.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook