# MyOpenMath/Solutions/Big-O

In this introduction to * Big O notation,* we solve two problems: one simple and the other so tricky I got a bit lost. The advantage of Big-O notation is that you can quickly "see" an answer without doing elaborate perturbation theory. Instead you just learn a few low order approximations for small . A few examples are , . All we need for this discussion is the first order approximation for .

## Ruler misalignment[edit | edit source]

Have you ever pondered the fact that you can measure your height without carefully verifying that the ruler is perfectly vertical? In the language of * Big O notation*, if the actual height is , the error is second order in the distance, , between the actual and proper locations of the bottom of the ruler (see figure). To understand how this all works, begin with the Pythagorean theorem and express the erroneously measured height as:

Advanced mathematics with numbers that have dimensions is best done by creating dimensionless variables, and this is especially true when analyzing approximations. A handy approximation is that whenever , we can write:

.

Here the "big-O" informs us that the next term is proportion to . The -symbol allows us to avoid consideration of this term, while at the same time, preserve the location of these higher order terms, in case the calculation needs to be improved. We define, , to be the error that arises from ruler misalignment. We presume that this error will be small ... *but small compared with what?* This problem has two large terms, , and two small ones . The big-O notation will help us sort things out. From the two equations displayed above:

#### Example[edit | edit source]

, then , which implies that:

*A horizontal displacement of one end of ruler's length by ten percent will increase the measured height by approximately half of one percent.*

This calculation is only an estimate that lacks a proper proof because higher order terms have been neglected. On the other hand, it is likely to be correct, since the next term in the expansion is of order .

#### Defining the small parameter[edit | edit source]

This section might seem unnecessary, but the next calculation is so weird that it might help to discuss it here: Whether something is "first" or "second" order depends on you choose to define things. Here we have chosen,

,

and we are working to "first order" in , even though it is "second" order in .

## Two slit diffraction with narrow slits[edit | edit source]

### When the screen is far from the slits[edit | edit source]

**Problem: **Two narrow slits are separated by 0.8 mm. The 15-th fringe appears 89 mm from the center of the diffraction pattern, and the screen is 9 m from the slits. What is the wavelength?

The standard textbook solution to this problem uses the formula, , where :

.

This solution is only valid when the distance to the screen, is much greater than the distance between the slits, . In the next section we will derive an exact equation, and then use big-O notation to recover the standard formula in the limit that is small.

- To learn about two slit diffraction visit:

- To see a hand written solution on MyOpenMath visit:

### When the screen is not far from the slits[edit | edit source]

The wavelength and dimensions of the device in the previous section were chosen so that the simple formula would yield the correct answer. But how we solve the problem when the spacing between the slits is close to the distance to the screen. The geometry is shown in the figure to the right. It helps to define,

so that:

Note from the figure that , and that the two paths are effectively parallel when . The exact formula for the path difference is:

where,

From the formulas stated without proof in the previous section, we are looking to show that:

.

We also seek insight into the nature of higher order correction terms in order to estimate when this simple formula is likely to be valid. The standard approach would be to perform a Taylor series expansion of the function , using as the variable. But in order to highlight big-O notation, we employ the aforementioned expansion:

.

Wright this expression with replaced by , and subtract the two:

When subtracting in the big-O notation, it is essential to realize that in general,

This is because stands for , where is some unknown constant. The difference between unknown constants is not usually zero. However in this case the exact cancellation of all even terms leaves us with an expression containing only terms that are odd in :

The absence of a second order term suggests that the first order term is likely to be sufficient for reasonably small values of . The physics of this problem informs us that, so that we seek and expression for,

,

We see here that our small parameter is,

One final task remains: Since since we need to replace = (...plus small terms.) It is left as an exercise for the reader to show that:

In other words, and are very close to each other, differing only at second order in our small parameter. Unless the three lengths are all of the same order and are not small:

We also note that , so that up to but not including third order, the difference in path length is:

,

which agrees with the formula found in most physics books.

#### Example[edit | edit source]

While not exact, the familiar formula for fringes when the screen is far away, the approximate formula, , works surprisingly well for the screen close to the slits. Here, The fringe number was (first maximum.)

Yet, the "small parameter" is not very small:

.

The approximate formula for the first fringe is depicted in the figure as , which equals the length of the line segment, .

The actual wavelength is . The point was by creating the (dotted) arc of length , which intersect with line , which has length . The approximation,

.

yields,

,

where,

,

is the exact wavelength, calculated from:

### Another approach[edit | edit source]

The big-O approach led us initially to a rather awkward small parameter,

In other words, the convenient small parameter differs from the useful small parameter by a small parameter. Weird, huh?

We could also solve this problem with a Taylor series. In anticipation of doing differential calculus, we replace by as the variable to represent the distance between the slits. Now define the path length difference by the function , where:

This looks like a lot of trouble, but symbolic software is available that can make this almost effortless. This expression also shows us why the big-O approach got into trouble. There are really two small dimensionless parameters lurking in this problem, and we can distinguish between them with subscripts:

,

so that

In other words we need to understand the function,

,

when and are small. What I would do here is a two-dimensional expansion: