1.3: Basic Classes of Functions

We have studied the general characteristics of functions, so now let’s examine some specific classes of functions. We finish the section with examples of piecewise-defined functions and take a look at how to sketch the graph of a function that has been shifted, stretched, or reflected from its initial form.

Linear Functions and Slope

The easiest type of function to consider is a linear function. Linear functions have the form (f(x)=ax+b), where (a) and (b) are constants. In Figure (PageIndex{1}), we see examples of linear functions when a is positive, negative, and zero. Note that if (a>0), the graph of the line rises as (x) increases. In other words, (f(x)=ax+b) is increasing on ((−∞, ∞)). If (a<0), the graph of the line falls as (x) increases. In this case, (f(x)=ax+b) is decreasing on ((−∞, ∞)). If (a=0), the line is horizontal.

Figure (PageIndex{1}): These linear functions are increasing or decreasing on ((∞, ∞)) and one function is a horizontal line.

As suggested by Figure, the graph of any linear function is a line. One of the distinguishing features of a line is its slope. The slope is the change in (y) for each unit change in (x). The slope measures both the steepness and the direction of a line. If the slope is positive, the line points upward when moving from left to right. If the slope is negative, the line points downward when moving from left to right. If the slope is zero, the line is horizontal. To calculate the slope of a line, we need to determine the ratio of the change in (y) versus the change in (x). To do so, we choose any two points ((x_1,y_1)) and ((x_2,y_2)) on the line and calculate (dfrac{y_2−y_1}{x_2−x_1}). In Figure (PageIndex{2}), we see this ratio is independent of the points chosen.

Figure (PageIndex{2}): For any linear function, the slope ((y_2−y_1)/(x_2−x_1)) is independent of the choice of points ((x_1,y_1)) and ((x_2,y_2)) on the line.

Definition: Linear Functions

Consider line (L) passing through points ((x_1,y_1)) and ((x_2,y_2)). Let (Δy=y_2−y_1) and (Δx=x_2−x_1) denote the changes in (y) and (x),respectively. The slope of the line is


We now examine the relationship between slope and the formula for a linear function. Consider the linear function given by the formula (f(x)=ax+b). As discussed earlier, we know the graph of a linear function is given by a line. We can use our definition of slope to calculate the slope of this line. As shown, we can determine the slope by calculating ((y_2−y_1)/(x_2−x_1)) for any points ((x_1,y_1)) and ((x_2,y_2)) on the line. Evaluating the function (f) at (x=0), we see that ((0,b)) is a point on this line. Evaluating this function at (x=1), we see that ((1,a+b)) is also a point on this line. Therefore, the slope of this line is


We have shown that the coefficient (a) is the slope of the line. We can conclude that the formula (f(x)=ax+b) describes a line with slope (a). Furthermore, because this line intersects the (y)-axis at the point ((0,b)), we see that the y-intercept for this linear function is ((0,b)). We conclude that the formula (f(x)=ax+b) tells us the slope, a, and the (y)-intercept, ((0,b)), for this line. Since we often use the symbol (m) to denote the slope of a line, we can write


to denote the slope-intercept form of a linear function.

Sometimes it is convenient to express a linear function in different ways. For example, suppose the graph of a linear function passes through the point ((x_1,y_1)) and the slope of the line is (m). Since any other point ((x,f(x))) on the graph of (f) must satisfy the equation


this linear function can be expressed by writing


We call this equation the point-slope equation for that linear function.

Since every nonvertical line is the graph of a linear function, the points on a nonvertical line can be described using the slope-intercept or point-slope equations. However, a vertical line does not represent the graph of a function and cannot be expressed in either of these forms. Instead, a vertical line is described by the equation (x=k) for some constant (k). Since neither the slope-intercept form nor the point-slope form allows for vertical lines, we use the notation


where (a,b) are both not zero, to denote the standard form of a line.

Definition: point-slope equation, point-slope equation and the standard form of a line

Consider a line passing through the point ((x_1,y_1)) with slope (m). The equation


is the point-slope equation for that line.

Consider a line with slope (m) and (y)-intercept ((0,b).) The equation


is an equation for that line in point-slope equation.

The standard form of a line is given by the equation


where (a) and (b) are both not zero. This form is more general because it allows for a vertical line, (x=k).

Example (PageIndex{1}): Finding the Slope and Equations of Lines

Consider the line passing through the points ((11,−4)) and ((−4,5)), as shown in Figure.

Figure (PageIndex{3}): Finding the equation of a linear function with a graph that is a line between two given points.

  1. Find the slope of the line.
  2. Find an equation for this linear function in point-slope form.
  3. Find an equation for this linear function in slope-intercept form.


1. The slope of the line is


2. To find an equation for the linear function in point-slope form, use the slope (m=−3/5) and choose any point on the line. If we choose the point ((11,−4)), we get the equation


3. To find an equation for the linear function in slope-intercept form, solve the equation in part b. for (f(x)). When we do this, we get the equation


Exercise (PageIndex{1})

Consider the line passing through points ((−3,2)) and ((1,4)).

  1. Find the slope of the line.
  2. Find an equation of that line in point-slope form.
  3. Find an equation of that line in slope-intercept form.

The slope (m=Δy/Δx).

Answer a


Answer b

The point-slope form is (y−4=dfrac{1}{2}(x−1)).

Answer c

The slope-intercept form is (y=dfrac{1}{2}x+dfrac{7}{2}).

Example (PageIndex{2}):

Jessica leaves her house at 5:50 a.m. and goes for a 9-mile run. She returns to her house at 7:08 a.m. Answer the following questions, assuming Jessica runs at a constant pace.

  1. Describe the distance (D) (in miles) Jessica runs as a linear function of her run time (t) (in minutes).
  2. Sketch a graph of (D).
  3. Interpret the meaning of the slope.


a. At time (t=0), Jessica is at her house, so (D(0)=0). At time (t=78) minutes, Jessica has finished running (9) mi, so (D(78)=9). The slope of the linear function is


The (y)-intercept is ((0,0)), so the equation for this linear function is


b. To graph (D), use the fact that the graph passes through the origin and has slope (m=3/26.)

c. The slope (m=3/26≈0.115) describes the distance (in miles) Jessica runs per minute, or her average velocity.


A linear function is a special type of a more general class of functions: polynomials. A polynomial function is any function that can be written in the form


for some integer (n≥0) and constants (a_n,a+{n−1},…,a_0), where (a_n≠0). In the case when (n=0), we allow for (a_0=0); if (a_0=0), the function (f(x)=0) is called the zero function. The value (n) is called the degree of the polynomial; the constant an is called the leading coefficient. A linear function of the form (f(x)=mx+b) is a polynomial of degree 1 if (m≠0) and degree 0 if (m=0). A polynomial of degree 0 is also called a constant function. A polynomial function of degree 2 is called a quadratic function. In particular, a quadratic function has the form (f(x)=ax^2+bx+c), where (a≠0). A polynomial function of degree (3) is called a cubic function.

Power Functions

Some polynomial functions are power functions. A power function is any function of the form (f(x)=ax^b), where (a) and (b) are any real numbers. The exponent in a power function can be any real number, but here we consider the case when the exponent is a positive integer. (We consider other cases later.) If the exponent is a positive integer, then (f(x)=ax^n) is a polynomial. If (n) is even, then (f(x)=ax^n) is an even function because (f(−x)=a(−x)^n=ax^n) if (n) is even. If (n) is odd, then (f(x)=ax^n) is an odd function because (f(−x)=a(−x)^n=−ax^n) if (n) is odd (Figure (PageIndex{3})).

Figure (PageIndex{4}): (a) For any even integer (n),(f(x)=ax^n) is an even function. (b) For any odd integer (n),(f(x)=ax^n) is an odd function.

Behavior at Infinity

To determine the behavior of a function (f) as the inputs approach infinity, we look at the values (f(x)) as the inputs, (x), become larger. For some functions, the values of (f(x)) approach a finite number. For example, for the function (f(x)=2+1/x), the values (1/x) become closer and closer to zero for all values of (x) as they get larger and larger. For this function, we say “(f(x)) approaches two as x goes to infinity,” and we write f(x)→2 as x→∞. The line y=2 is a horizontal asymptote for the function (f(x)=2+1/x) because the graph of the function gets closer to the line as (x) gets larger.

For other functions, the values (f(x)) may not approach a finite number but instead may become larger for all values of x as they get larger. In that case, we say “(f(x)) approaches infinity as (x) approaches infinity,” and we write (f(x)→∞) as (x→∞). For example, for the function (f(x)=3x^2), the outputs (f(x)) become larger as the inputs (x) get larger. We can conclude that the function (f(x)=3x^2) approaches infinity as (x) approaches infinity, and we write (3x^2→∞) as (x→∞). The behavior as (x→−∞) and the meaning of (f(x)→−∞) as (x→∞) or (x→−∞) can be defined similarly. We can describe what happens to the values of (f(x)) as (x→∞) and as (x→−∞) as the end behavior of the function.

To understand the end behavior for polynomial functions, we can focus on quadratic and cubic functions. The behavior for higher-degree polynomials can be analyzed similarly. Consider a quadratic function (f(x)=ax^2+bx+c). If (a>0), the values (f(x)→∞) as (x→±∞). If (a<0), the values (f(x)→−∞) as (x→±∞). Since the graph of a quadratic function is a parabola, the parabola opens upward if (a>0).; the parabola opens downward if (a<0) (Figure (PageIndex{4a})).

Now consider a cubic function (f(x)=ax^3+bx^2+cx+d). If (a>0), then (f(x)→∞) as (x→∞) and (f(x)→−∞) as (x→−∞). If (a<0), then (f(x)→−∞) as (x→∞) and (f(x)→∞) as (x→−∞). As we can see from both of these graphs, the leading term of the polynomial determines the end behavior (Figure (PageIndex{4b})).

Figure (PageIndex{5}): (a) For a quadratic function, if the leading coefficient (a>0),the parabola opens upward. If (a<0), the parabola opens downward. (b) For a cubic function (f), if the leading coefficient (a>0), the values (f(x)→∞) as (x→∞) and the values (f(x)→−∞) as (x→−∞). If the leading coefficient (a<0), the opposite is true.

Zeros of Polynomial Functions

Another characteristic of the graph of a polynomial function is where it intersects the (x)-axis. To determine where a function f intersects the (x)-axis, we need to solve the equation (f(x)=0) for (n) the case of the linear function (f(x)=mx+b), the (x)-intercept is given by solving the equation (mx+b=0). In this case, we see that the (x)-intercept is given by ((−b/m,0)). In the case of a quadratic function, finding the (x)-intercept(s) requires finding the zeros of a quadratic equation: (ax^2+bx+c=0). In some cases, it is easy to factor the polynomial (ax^2+bx+c) to find the zeros. If not, we make use of the quadratic formula.

Rule: The Quadratic Formula

Consider the quadratic equation


where (a≠0). The solutions of this equation are given by the quadratic formula

[x=dfrac{−b±sqrt{b^2−4ac}}{2a}. label{quad}]

If the discriminant (b^2−4ac>0), Equation ef{quad} tells us there are two real numbers that satisfy the quadratic equation. If (b^2−4ac=0), this formula tells us there is only one solution, and it is a real number. If (b^2−4ac<0), no real numbers satisfy the quadratic equation.

In the case of higher-degree polynomials, it may be more complicated to determine where the graph intersects the x-axis. In some instances, it is possible to find the (x)-intercepts by factoring the polynomial to find its zeros. In other cases, it is impossible to calculate the exact values of the (x)-intercepts. However, as we see later in the text, in cases such as this, we can use analytical tools to approximate (to a very high degree) where the (x)-intercepts are located. Here we focus on the graphs of polynomials for which we can calculate their zeros explicitly.

Example (PageIndex{3}): Graphing Polynomial Functions

For the following functions,

  1. (f(x)=−2x^2+4x−1)
  2. (f(x)=x^3−3x^2−4x)
  1. describe the behavior of (f(x)) as (x→±∞),
  2. find all zeros of (f), and
  3. sketch a graph of (f).


1.The function (f(x)=−2x^2+4x−1) is a quadratic function.

1.Because (a=−2<0),as (x→±∞,f(x)→−∞.)

2. To find the zeros of (f), use the quadratic formula. The zeros are


3.To sketch the graph of (f),use the information from your previous answers and combine it with the fact that the graph is a parabola opening downward.

2. The function (f(x)=x^3−3x^2−4x) is a cubic function.

1.Because (a=1>0),as (x→∞), (f(x)→∞). As (x→−∞), (f(x)→−∞).

2.To find the zeros of (f), we need to factor the polynomial. First, when we factor (x|) out of all the terms, we find


Then, when we factor the quadratic function (x^2−3x−4), we find


Therefore, the zeros of f are (x=0,4,−1).

3. Combining the results from parts i. and ii., draw a rough sketch of (f).

Exercise (PageIndex{2})

Consider the quadratic function (f(x)=3x^2−6x+2.) Find the zeros of (f). Does the parabola open upward or downward?


Ue the quadric formula


The zeros are (x=1±sqrt{3}/3). The parabola opens upward.

Mathematical Models

A large variety of real-world situations can be described using mathematical models. A mathematical model is a method of simulating real-life situations with mathematical equations. Physicists, engineers, economists, and other researchers develop models by combining observation with quantitative data to develop equations, functions, graphs, and other mathematical tools to describe the behavior of various systems accurately. Models are useful because they help predict future outcomes. Examples of mathematical models include the study of population dynamics, investigations of weather patterns, and predictions of product sales.

As an example, let’s consider a mathematical model that a company could use to describe its revenue for the sale of a particular item. The amount of revenue (R) a company receives for the sale of n items sold at a price of (p) dollars per item is described by the equation (R=p⋅n). The company is interested in how the sales change as the price of the item changes. Suppose the data in Table show the number of units a company sells as a function of the price per item.

Number of Units Sold (n) (in Thousands) as a Function of Price per Unit (p) (in Dollars)

In Figure, we see the graph the number of units sold (in thousands) as a function of price (in dollars). We note from the shape of the graph that the number of units sold is likely a linear function of price per item, and the data can be closely approximated by the linear function (n= −1.04p+26) for (0≤p≤25), where (n) predicts the number of units sold in thousands. Using this linear function, the revenue (in thousands of dollars) can be estimated by the quadratic function

[R(p)=p⋅ (−1.04p+26)=−1.04p^2+26p]

for (0≤p≤25) In Example (PageIndex{1}), we use this quadratic function to predict the amount of revenue the company receives depending on the price the company charges per item. Note that we cannot conclude definitively the actual number of units sold for values of (p), for which no data are collected. However, given the other data values and the graph shown, it seems reasonable that the number of units sold (in thousands) if the price charged is (p) dollars may be close to the values predicted by the linear function (n=−1.04p+26.)

Figure (PageIndex{6}): The data collected for the number of items sold as a function of price is roughly linear. We use the linear function (n=−1.04p+26) to estimate this function.

Example (PageIndex{4}): Maximizing Revenue

A company is interested in predicting the amount of revenue it will receive depending on the price it charges for a particular item. Using the data from Table, the company arrives at the following quadratic function to model revenue (R) as a function of price per item (p:)


for 0≤p≤25.

  1. Predict the revenue if the company sells the item at a price of (p=$5) and (p=$17).
  2. Find the zeros of this function and interpret the meaning of the zeros.
  3. Sketch a graph of (R).
  4. Use the graph to determine the value of (p) that maximizes revenue. Find the maximum revenue.


a. Evaluating the revenue function at (p=5) and (p=17), we can conclude that

(R(5)=−1.04(5)^2+26(5)=104,so revenue=$104,000;)

(R(17)=−1.04(17)^2+26(17)=141.44,so revenue=$144,440.)

b. The zeros of this function can be found by solving the equation (−1.04p^2+26p=0). When we factor the quadratic expression, we get (p(−1.04p+26)=0). The solutions to this equation are given by (p=0,25). For these values of (p), the revenue is zero. When (p=$0), the revenue is zero because the company is giving away its merchandise for free. When (p=$25),the revenue is zero because the price is too high, and no one will buy any items.

c. Knowing the fact that the function is quadratic, we also know the graph is a parabola. Since the leading coefficient is negative, the parabola opens downward. One property of parabolas is that they are symmetric about the axis, so since the zeros are at (p=0) and (p=25), the parabola must be symmetric about the line halfway between them, or (p=12.5).

d. The function is a parabola with zeros at (p=0) and (p=25), and it is symmetric about the line (p=12.5), so the maximum revenue occurs at a price of (p=$12.50) per item. At that price, the revenue is (R(p)=−1.04(12.5)^2+26(12.5)=$162,500.)

Algebraic Functions

By allowing for quotients and fractional powers in polynomial functions, we create a larger class of functions. An algebraic function is one that involves addition, subtraction, multiplication, division, rational powers, and roots. Two types of algebraic functions are rational functions and root functions.

Just as rational numbers are quotients of integers, rational functions are quotients of polynomials. In particular, a rational function is any function of the form (f(x)=p(x)/q(x)),where (p(x)) and (q(x)) are polynomials. For example,

(f(x)=dfrac{3x−1}{5x+2}) and (g(x)=dfrac{4}{x^2+1})

are rational functions. A root function is a power function of the form (f(x)=x^{1/n}), where n is a positive integer greater than one. For example, f(x)=x1/2=x√ is the square-root function and (g(x)=x^{1/3}=sqrt[3]{x})) is the cube-root function. By allowing for compositions of root functions and rational functions, we can create other algebraic functions. For example, (f(x)=sqrt{4−x^2}) is an algebraic function.

Example (PageIndex{5}): Finding Domain and Range for Algebraic Functions

For each of the following functions, find the domain and range.

  1. (f(x)=dfrac{3x−1}{5x+2})
  2. (f(x)=sqrt{4−x^2})


1.It is not possible to divide by zero, so the domain is the set of real numbers (x) such that (x≠−2/5). To find the range, we need to find the values (y) for which there exists a real number (x) such that


When we multiply both sides of this equation by (5x+2), we see that (x) must satisfy the equation


From this equation, we can see that (x) must satisfy


If y=(3/5), this equation has no solution. On the other hand, as long as (y≠3/5),


satisfies this equation. We can conclude that the range of (f) is ({y|y≠3/5}).

2. To find the domain of (f), we need (4−x^2≥0). When we factor, we write (4−x^2=(2−x)(2+x)≥0). This inequality holds if and only if both terms are positive or both terms are negative. For both terms to be positive, we need to find (x) such that

(2−x≥0) and (2+x≥0.)

These two inequalities reduce to (2≥x) and (x≥−2). Therefore, the set ({x|−2≤x≤2}) must be part of the domain. For both terms to be negative, we need

(2−x≤0) and (2+x≥0.)

These two inequalities also reduce to (2≤x) and (x≥−2). There are no values of (x) that satisfy both of these inequalities. Thus, we can conclude the domain of this function is ({x|−2≤x≤2}.)

If (−2≤x≤2), then (0≤4−x^2≤4). Therefore, (0≤sqrt{4−x2}≤2), and the range of (f) is ({y|0≤y≤2}.)

Exercise (PageIndex{3})

Find the domain and range for the function (f(x)=(5x+2)/(2x−1).)


The denominator cannot be zero. Solve the equation (y=(5x+2)/(2x−1)) for (x) to find the range.


The domain is the set of real numbers (x) such that (x≠1/2). The range is the set ({y|y≠5/2}).

The root functions (f(x)=x^{1/n}) have defining characteristics depending on whether (n) is odd or even. For all even integers (n≥2), the domain of (f(x)=x^{1/n}) is the interval ([0,∞)). For all odd integers (n≥1), the domain of (f(x)=x^{1/n}) is the set of all real numbers. Since (x^{1/n}=(−x)^{1/n}) for odd integers (n) ,(f(x)=x^{1/n}) is an odd function if(n) is odd. See the graphs of root functions for different values of (n) in Figure.

Figure (PageIndex{7}): (a) If (n) is even, the domain of (f(x)=sqrt[n]{x}) is ([0,∞)). (b) If (n) is odd, the domain of (f(x)=dfrac[n]{x}) is ((−∞,∞)) and the function (f(x)=dfrac[n]{x}) is an odd function.

Example (PageIndex{6}): Finding Domains for Algebraic Functions

For each of the following functions, determine the domain of the function.

  1. (f(x)=dfrac{3}{x^2−1})
  2. (f(x)=dfrac{2x+5}{3x^2+4})
  3. (f(x)=sqrt{4−3x})
  4. (f(x)=sqrt[3]{2x−1})


  1. You cannot divide by zero, so the domain is the set of values (x) such that (x^2−1≠0). Therefore, the domain is ({x|x≠±1}).
  2. You need to determine the values of (x) for which the denominator is zero. Since (3x^2+4≥4) for all real numbers (x), the denominator is never zero. Therefore, the domain is ((−∞,∞).)
  3. Since the square root of a negative number is not a real number, the domain is the set of values (x) for which (4−3x≥0). Therefore, the domain is ({x|x≤4/3}.)
  4. The cube root is defined for all real numbers, so the domain is the interval ((−∞, ∞).)

Exercise (PageIndex{4})

Find the domain for each of the following functions: (f(x)=(5−2x)/(x^2+2)) and (g(x)=sqrt{5x−1}).


Determine the values of (x) when the expression in the denominator of (f) is nonzero, and find the values of (x) when the expression inside the radical of (g) is nonnegative.


The domain of (f) is ((−∞, ∞)). The domain of (g) is ({x|x≥1/5}.)

Transcendental Functions

Thus far, we have discussed algebraic functions. Some functions, however, cannot be described by basic algebraic operations. These functions are known as transcendental functions because they are said to “transcend,” or go beyond, algebra. The most common transcendental functions are trigonometric, exponential, and logarithmic functions. A trigonometric function relates the ratios of two sides of a right triangle. They are (sinx, cosx, tanx, cotx, secx, and cscx.) (We discuss trigonometric functions later in the chapter.) An exponential function is a function of the form (f(x)=b^x), where the base (b>0,b≠1). A logarithmic function is a function of the form (f(x)=log_b(x)) for some constant (b>0,b≠1,) where (log_b(x)=y) if and only if (b^y=x). (We also discuss exponential and logarithmic functions later in the chapter.)

Example (PageIndex{7}): Classifying Algebraic and Transcendental Functions

Classify each of the following functions, a. through c., as algebraic or transcendental.

  1. (f(x)=dfrac{sqrt{x^3+1}}{4x+2})
  2. (f(x)=2^{x^2})
  3. ( f(x)=sin(2x))


  1. Since this function involves basic algebraic operations only, it is an algebraic function.
  2. This function cannot be written as a formula that involves only basic algebraic operations, so it is transcendental. (Note that algebraic functions can only have powers that are rational numbers.)
  3. As in part b, this function cannot be written using a formula involving basic algebraic operations only; therefore, this function is transcendental.

Exercise (PageIndex{5}):

Is (f(x)=x/2) an algebraic or a transcendental function?



Piecewise-Defined Functions

Sometimes a function is defined by different formulas on different parts of its domain. A function with this property is known as a piecewise-defined function. The absolute value function is an example of a piecewise-defined function because the formula changes with the sign of (x):

[f(x)=egin{cases}−x & x<0x & x≥0end{cases}.]

Other piecewise-defined functions may be represented by completely different formulas, depending on the part of the domain in which a point falls. To graph a piecewise-defined function, we graph each part of the function in its respective domain, on the same coordinate system. If the formula for a function is different for (xa), we need to pay special attention to what happens at (x=a) when we graph the function. Sometimes the graph needs to include an open or closed circle to indicate the value of the function at (x=a). We examine this in the next example.

Example (PageIndex{8}): Graphing a Piecewise-Defined Function

Sketch a graph of the following piecewise-defined function:



Graph the linear function (y=x+3) on the interval ((−∞,1)) and graph the quadratic function (y=(x−2)^2) on the interval ([1,∞)). Since the value of the function at (x=1) is given by the formula (f(x)=(x−2)^2), we see that (f(1)=1). To indicate this on the graph, we draw a closed circle at the point ((1,1)). The value of the function is given by (f(x)=x+2) for all (x<1), but not at (x=1). To indicate this on the graph, we draw an open circle at ((1,4)).

Figure (PageIndex{8}): This piecewise-defined function is linear for (x<1) and quadratic for (x≥1.)

2) Sketch a graph of the function



Example (PageIndex{9}): Parking Fees Described by a Piecewise-Defined Function

In a big city, drivers are charged variable rates for parking in a parking garage. They are charged $10 for the first hour or any part of the first hour and an additional $2 for each hour or part thereof up to a maximum of $30 for the day. The parking garage is open from 6 a.m. to 12 midnight.

  1. Write a piecewise-defined function that describes the cost (C) to park in the parking garage as a function of hours parked (x).
  2. Sketch a graph of this function (C(x).)


1.Since the parking garage is open 18 hours each day, the domain for this function is ({x|0


2.The graph of the function consists of several horizontal line segments.

Exercise (PageIndex{6})

The cost of mailing a letter is a function of the weight of the letter. Suppose the cost of mailing a letter is (49¢) for the first ounce and (21¢) for each additional ounce. Write a piecewise-defined function describing the cost (C) as a function of the weight (x) for (0


The piecewise-defined function is constant on the intervals (0,1],(1,2],….



Transformations of Functions

We have seen several cases in which we have added, subtracted, or multiplied constants to form variations of simple functions. In the previous example, for instance, we subtracted 2 from the argument of the function (y=x^2) to get the function( f(x)=(x−2)^2). This subtraction represents a shift of the function (y=x^2) two units to the right. A shift, horizontally or vertically, is a type of transformation of a function. Other transformations include horizontal and vertical scalings, and reflections about the axes.

A vertical shift of a function occurs if we add or subtract the same constant to each output (y). For (c>0), the graph of (f(x)+c) is a shift of the graph of (f(x)) up c units, whereas the graph of (f(x)−c) is a shift of the graph of (f(x)) down (c) units. For example, the graph of the function (f(x)=x^3+4) is the graph of (y=x^3) shifted up (4) units; the graph of the function (f(x)=x^3−4) is the graph of (y=x^3) shifted down (4) units (Figure (PageIndex{6})).

Figure (PageIndex{9}): (a) For (c>0), the graph of (y=f(x)+c) is a vertical shift up (c) units of the graph of (y=f(x)). (b) For (c>0), the graph of (y=f(x)−c) is a vertical shift down c units of the graph of (y=f(x)).

A horizontal shift of a function occurs if we add or subtract the same constant to each input (x). For (c>0), the graph of (f(x+c)) is a shift of the graph of (f(x)) to the left (c) units; the graph of (f(x−c)) is a shift of the graph of (f(x)) to the right (c) units. Why does the graph shift left when adding a constant and shift right when subtracting a constant? To answer this question, let’s look at an example.

Consider the function (f(x)=|x+3|) and evaluate this function at (x−3). Since (f(x−3)=|x|) and (x−3

Figure (PageIndex{10}): (a) For (c>0), the graph of (y=f(x+c)) is a horizontal shift left (c) units of the graph of (y=f(x)). (b) For (c>0), the graph of (y=f(x−c)) is a horizontal shift right (c) units of the graph of (y=f(x).)

A vertical scaling of a graph occurs if we multiply all outputs (y) of a function by the same positive constant. For (c>0), the graph of the function (cf(x)) is the graph of (f(x)) scaled vertically by a factor of (c). If (c>1), the values of the outputs for the function (cf(x)) are larger than the values of the outputs for the function (f(x)); therefore, the graph has been stretched vertically. If (0

Figure (PageIndex{11}): (a) If (c>1), the graph of (y=cf(x)) is a vertical stretch of the graph of (y=f(x)). (b) If (0

The horizontal scaling of a function occurs if we multiply the inputs (x) by the same positive constant. For (c>0), the graph of the function (f(cx)) is the graph of (f(x)) scaled horizontally by a factor of (c). If (c>1), the graph of (f(cx)) is the graph of (f(x)) compressed horizontally. If (0

Figure (PageIndex{12}): (a) If (c>1), the graph of (y=f(cx)) is a horizontal compression of the graph of (y=f(x)). (b) If (0

We have explored what happens to the graph of a function (f) when we multiply (f) by a constant (c>0) to get a new function (cf(x)). We have also discussed what happens to the graph of a function (f)when we multiply the independent variable (x) by (c>0) to get a new function (f(cx)). However, we have not addressed what happens to the graph of the function if the constant (c) is negative. If we have a constant (c<0), we can write (c) as a positive number multiplied by (−1); but, what kind of transformation do we get when we multiply the function or its argument by (−1?) When we multiply all the outputs by (−1), we get a reflection about the (x)-axis. When we multiply all inputs by (−1), we get a reflection about the (y)-axis. For example, the graph of (f(x)=−(x^3+1)) is the graph of (y=(x^3+1)) reflected about the (x)-axis. The graph of (f(x)=(−x)^3+1) is the graph of (y=x^3+1) reflected about the (y)-axis (Figure (PageIndex{10})).

Figure (PageIndex{13}): (a) The graph of (y=−f(x)) is the graph of (y=f(x)) reflected about the (x)-axis. (b) The graph of (y=f(−x)) is the graph of (y=f(x)) reflected about the (y)-axis.

If the graph of a function consists of more than one transformation of another graph, it is important to transform the graph in the correct order. Given a function (f(x)), the graph of the related function (y=cf(a(x+b))+d) can be obtained from the graph of (y=f(x))by performing the transformations in the following order.

  • Horizontal shift of the graph of (y=f(x)). If (b>0), shift left. If (b<0) shift right.
  • Horizontal scaling of the graph of (y=f(x+b)) by a factor of (|a|). If (a<0), reflect the graph about the (y)-axis.
  • Vertical scaling of the graph of (y=f(a(x+b))) by a factor of (|c|). If (c<0), reflect the graph about the (x) -axis.
  • Vertical shift of the graph of (y=cf(a(x+b))). If (d>0), shift up. If (d<0), shift down.

We can summarize the different transformations and their related effects on the graph of a function in the following table.

Transformation of (f (c>0))Effect of the graph of (f)
(f(x)+c)Vertical shift up (c) units
(f(x)-c)Vertical shift down (c) units
(f(x+c))Shift left by (c) units
(f(x-c))Shift right by (c) units

Vertical stretch if (c>1);

vertical compression if (0


Horizontal stretch if (0

horizontal compression if (c>1)

(-f(x))Reflection about the (x)-axis
(-f(x))Reflection about the (y)-axis

Example (PageIndex{10}): Transforming a Function

For each of the following functions, a. and b., sketch a graph by using a sequence of transformations of a well-known function.

  1. (f(x)=−|x+2|−3)
  2. (f(x)=sqrt[3]{x}+1)


1.Starting with the graph of (y=|x|), shift (2) units to the left, reflect about the (x)-axis, and then shift down (3) units.

Figure (PageIndex{14}): The function (f(x)=−|x+2|−3) can be viewed as a sequence of three transformations of the function (y=|x|).

2. Starting with the graph of y=x√, reflect about the y-axis, stretch the graph vertically by a factor of 3, and move up 1 unit.

Figure (PageIndex{15}): The function (f(x)=sqrt[3]{x}+1)can be viewed as a sequence of three transformations of the function (y=sqrt{x}).

Exercise (PageIndex{7})

Describe how the function (f(x)=−(x+1)^2−4) can be graphed using the graph of (y=x^2) and a sequence of transformations


Shift the graph (y=x^2) to the left 1 unit, reflect about the (x)-axis, then shift down 4 units.

Key Concepts

  • The power function (f(x)=x^n) is an even function if n is even and (n≠0), and it is an odd function if (n) is odd.
  • The root function (f(x)=x^{1/n}) has the domain ([0,∞)) if n is even and the domain ((−∞,∞)) if (n) is odd. If (n) is odd, then (f(x)=x^{1/n}) is an odd function.
  • The domain of the rational function (f(x)=p(x)/q(x)), where (p(x)) and (q(x)) are polynomial functions, is the set of x such that (q(x)≠0).
  • Functions that involve the basic operations of addition, subtraction, multiplication, division, and powers are algebraic functions. All other functions are transcendental. Trigonometric, exponential, and logarithmic functions are examples of transcendental functions.
  • A polynomial function (f) with degree (n≥1) satisfies (f(x)→±∞) as (x→±∞). The sign of the output as (x→∞) depends on the sign of the leading coefficient only and on whether (n) is even or odd.
  • Vertical and horizontal shifts, vertical and horizontal scalings, and reflections about the (x)- and (y)-axes are examples of transformations of functions.

Key Equations

  • Point-slope equation of a line


  • Slope-intercept form of a line


  • Standard form of a line


  • Polynomial function



algebraic function
a function involving any combination of only the basic operations of addition, subtraction, multiplication, division, powers, and roots applied to an input variable (x)
cubic function
a polynomial of degree 3; that is, a function of the form (f(x)=ax^3+bx^2+cx+d), where (a≠0)
for a polynomial function, the value of the largest exponent of any term
linear function
a function that can be written in the form (f(x)=mx+b)
logarithmic function
a function of the form (f(x)=log_b(x)) for some base (b>0,b≠1) such that (y=log_b(x)) if and only if (b^y=x)
mathematical model
A method of simulating real-life situations with mathematical equations
piecewise-defined function
a function that is defined differently on different parts of its domain
point-slope equation
equation of a linear function indicating its slope and a point on the graph of the function
polynomial function
a function of the form (f(x)=a_nx^n+a_{n−1}x^{n−1}+…+a_1x+a_0)
power function
a function of the form (f(x)=x^n) for any positive integer (n≥1)
quadratic function
a polynomial of degree 2; that is, a function of the form (f(x)=ax^2+bx+c) where (a≠0)
rational function
a function of the form (f(x)=p(x)/q(x)), where (p(x)) and (q(x)) are polynomials
root function
a function of the form (f(x)=x^{1/n}) for any integer (n≥2)
the change in y for each unit change in x
slope-intercept form
equation of a linear function indicating its slope and y-intercept
transcendental function
a function that cannot be expressed by a combination of basic arithmetic operations
transformation of a function
a shift, scaling, or reflection of a function


  • Gilbert Strang (MIT) and Edwin “Jed” Herman (Harvey Mudd) with many contributing authors. This content by OpenStax is licensed with a CC-BY-SA-NC 4.0 license. Download for free at

Complexity class

In computational complexity theory, a complexity class is a set of computational problems of related resource-based complexity. The two most commonly analyzed resources are time and memory.

In general, a complexity class is defined in terms of a type of computational problem, a model of computation, and a bounded resource like time or memory. In particular, most complexity classes consist of decision problems that are solvable with a Turing machine, and are differentiated by their time or space (memory) requirements. For instance, the class P is the set of decision problems solvable by a deterministic Turing machine in polynomial time. There are, however, many complexity classes defined in terms of other types of problems (e.g. counting problems and function problems) and using other models of computation (e.g. probabilistic Turing machines, interactive proof systems, Boolean circuits, and quantum computers).

The study of the relationships between complexity classes is a major area of research in theoretical computer science. There are often general hierarchies of complexity classes for example, it is known that a number of fundamental time and space complexity classes relate to each other in the following way: NLPNPPSPACEEXPTIMEEXPSPACE (where ⊆ denotes the subset relation). However, many relationships are not yet known for example, one of the most famous open problems in computer science concerns whether or not P equals NP. The relationships between classes often answer questions about the fundamental nature of computation. The P versus NP problem, for instance, is directly related to questions of whether nondeterminism adds any computational power to computers and whether problems having a solution that can be quickly checked for correctness can also be quickly solved.

1.3: Basic Classes of Functions

data Bool = False | True deriving
(Read, Show, Eq, Ord, Enum, Bounded)

The boolean type Bool is an enumeration. The basic boolean functions are && (and), || (or), and not. The name otherwise is defined as True to make guarded expressions more readable.

6.1.2 Characters and Strings

The character type Char is an enumeration whose values represent Unicode characters [11]. The lexical syntax for characters is defined in Section 2.6 character literals are nullary constructors in the datatype Char. Type Char is an instance of the classes Read, Show, Eq, Ord, Enum, and Bounded. The toEnum and fromEnum functions, standard functions from class Enum, map characters to and from the Int type.

Note that ASCII control characters each have several representations in character literals: numeric escapes, ASCII mnemonic escapes, and the ^ X notation. In addition, there are the following equivalences: a and BEL,  and BS, f and FF, and CR, and HT, v and VT, and and LF.

A string is a list of characters:

Strings may be abbreviated using the lexical syntax described in Section 2.6. For example, "A string" abbreviates

6.1.3 Lists

data [a] = [] | a : [a] deriving (Eq, Ord)

Lists are an algebraic datatype of two constructors, although with special syntax, as described in Section 3.7. The first constructor is the null list, written `[]' ("nil"), and the second is `:' ("cons"). The module PreludeList (see Section 8.1) defines many standard list functions. Arithmetic sequences and list comprehensions, two convenient syntaxes for special kinds of lists, are described in Sections 3.10 and 3.11, respectively. Lists are an instance of classes Read, Show, Eq, Ord, Monad, Functor, and MonadPlus.

6.1.4 Tuples

Tuples are algebraic datatypes with special syntax, as defined in Section 3.8. Each tuple type has a single constructor. All tuples are instances of Eq, Ord, Bounded, Read, and Show (provided, of course, that all their component types are).

There is no upper bound on the size of a tuple, but some Haskell implementations may restrict the size of tuples, and limit the instances associated with larger tuples. However, every Haskell implementation must support tuples up to size 15, together with the instances for Eq, Ord, Bounded, Read, and Show. The Prelude and libraries define tuple functions such as zip for tuples up to a size of 7.

The constructor for a tuple is written by omitting the expressions surrounding the commas thus (x,y) and (,) x y produce the same value. The same holds for tuple type constructors thus, (Int,Bool,Int) and (,,) Int Bool Int denote the same type.

The following functions are defined for pairs (2-tuples): fst, snd, curry, and uncurry. Similar functions are not predefined for larger tuples.

6.1.5 The Unit Datatype

data () = () deriving (Eq, Ord, Bounded, Enum, Read, Show)

The unit datatype () has one non- _|_ member, the nullary constructor (). See also Section 3.9.

6.1.6 Function Types

6.1.7 The IO and IOError Types

IOError is an abstract type representing errors raised by I/O operations. It is an instance of Show and Eq. Values of this type are constructed by the various I/O functions and are not presented in any further detail in this report. The Prelude contains a few I/O functions (defined in Section 8.3), and Part II contains many more.

6.1.8 Other Types

data Maybe a = Nothing | Just a deriving (Eq, Ord, Read, Show)
data Either a b = Left a | Right b deriving (Eq, Ord, Read, Show)
data Ordering = LT | EQ | GT deriving
(Eq, Ord, Bounded, Enum, Read, Show)

The Maybe type is an instance of classes Functor, Monad, and MonadPlus. The Ordering type is used by compare in the class Ord. The functions maybe and either are found in the Prelude.

6.2 Strict Evaluation

The function seq is defined by the equations:

seq _|_b = _|_
seq a b = b, if a /=_|_

seq is usually introduced to improve performance by avoiding unneeded laziness. Strict datatypes (see Section 4.2.1) are defined in terms of the $! operator. However, the provision of seq has important semantic consequences, because it is available at every type . As a consequence, _|_ is not the same as x -> _|_ , since seq can be used to distinguish them. For the same reason, the existence of seq weakens Haskell's parametricity properties.

The operator $! is strict (call-by-value) application, and is defined in terms of seq. The Prelude also defines the $ operator to perform non-strict application.

infixr 0 $, $!
($), ($!) :: (a -> b) -> a -> b
f $ x = f x
f $! x = x `seq` f x

It is also useful in higher-order situations, such as map ($ 0) xs, or zipWith ($) fs xs.

6.3 Standard Haskell Classes

Figure 5

Standard Haskell Classes

Default class method declarations (Section 4.3) are provided for many of the methods in standard classes. A comment with each class declaration in Chapter 8 specifies the smallest collection of method definitions that, together with the default declarations, provide a reasonable definition for all the class methods. If there is no such comment, then all class methods must be given to fully specify an instance.

6.3.1 The Eq Class

class Eq a where
(==), (/=) :: a -> a -> Bool

x /= y = not (x == y)
x == y = not (x /= y)

The Eq class provides equality (==) and inequality (/=) methods. All basic datatypes except for functions and IO are instances of this class. Instances of Eq can be derived for any user-defined datatype whose constituents are also instances of Eq.

This declaration gives default method declarations for both /= and ==, each being defined in terms of the other. If an instance declaration for Eq defines neither == nor /=, then both will loop. If one is defined, the default method for the other will make use of the one that is defined. If both are defined, neither default method is used.

6.3.2 The Ord Class

class (Eq a) => Ord a where
compare :: a -> a -> Ordering
(<), (<=), (>=), (>) :: a -> a -> Bool
max, min :: a -> a -> a

compare x y | x == y = EQ
| x <= y = LT
| otherwise = GT

x <= y = compare x y /= GT
x < y = compare x y == LT
x >= y = compare x y /= LT
x > y = compare x y == GT

-- Note that (min x y, max x y) = (x,y) or (y,x)
max x y | x <= y = y
| otherwise = x
min x y | x <= y = x
| otherwise = y

The Ord class is used for totally ordered datatypes. All basic datatypes except for functions, IO, and IOError, are instances of this class. Instances of Ord can be derived for any user-defined datatype whose constituent types are in Ord. The declared order of the constructors in the data declaration determines the ordering in derived Ord instances. The Ordering datatype allows a single comparison to determine the precise ordering of two objects.

The default declarations allow a user to create an Ord instance either with a type-specific compare function or with type-specific == and <= functions.

6.3.3 The Read and Show Classes

type ReadS a = String -> [(a,String)]
type ShowS = String -> String

class Read a where
readsPrec :: Int -> ReadS a
readList :: ReadS [a]
-- . default decl for readList given in Prelude

class Show a where
showsPrec :: Int -> a -> ShowS
show :: a -> String
showList :: [a] -> ShowS

showsPrec _ x s = show x ++ s
show x = showsPrec 0 x ""
-- . default decl for showList given in Prelude

The Read and Show classes are used to convert values to or from strings. The Int argument to showsPrec and readsPrec gives the operator precedence of the enclosing context (see Section 10.4).

showsPrec and showList return a String-to-String function, to allow constant-time concatenation of its results using function composition. A specialised variant, show, is also provided, which uses precedence context zero, and returns an ordinary String. The method showList is provided to allow the programmer to give a specialised way of showing lists of values. This is particularly useful for the Char type, where values of type String should be shown in double quotes, rather than between square brackets.

Derived instances of Read and Show replicate the style in which a constructor is declared: infix constructors and field names are used on input and output. Strings produced by showsPrec are usually readable by readsPrec.

All Prelude types, except function types and IO types, are instances of Show and Read. (If desired, a programmer can easily make functions and IO types into (vacuous) instances of Show, by providing an instance declaration.)

For convenience, the Prelude provides the following auxiliary functions:

reads :: (Read a) => ReadS a
reads = readsPrec 0

shows :: (Show a) => a -> ShowS
shows = showsPrec 0

read :: (Read a) => String -> a
read s = case [x | (x,t) <- reads s, ("","") <- lex t] of
[x] -> x
[] -> error " no parse"
_ -> error " ambiguous parse"

shows and reads use a default precedence of 0. The read function reads input from a string, which must be completely consumed by the input process.

The function lex :: ReadS String, used by read, is also part of the Prelude. It reads a single lexeme from the input, discarding initial white space, and returning the characters that constitute the lexeme. If the input string contains only white space, lex returns a single successful "lexeme" consisting of the empty string. (Thus lex "" = [("","")].) If there is no legal lexeme at the beginning of the input string, lex fails (i.e. returns []).

6.3.4 The Enum Class

class Enum a where
succ, pred :: a -> a
toEnum :: Int -> a
fromEnum :: a -> Int
enumFrom :: a -> [a] -- [n..]
enumFromThen :: a -> a -> [a] -- [n,n'..]
enumFromTo :: a -> a -> [a] -- [n..m]
enumFromThenTo :: a -> a -> a -> [a] -- [n,n'..m]

-- Default declarations given in Prelude

Class Enum defines operations on sequentially ordered types. The functions succ and pred return the successor and predecessor, respectively, of a value. The functions fromEnum and toEnum map values from a type in Enum to and from Int. The enumFrom. methods are used when translating arithmetic sequences (Section 3.10).

Instances of Enum may be derived for any enumeration type (types whose constructors have no fields) see Chapter 10.

    The calls succ maxBound and pred minBound should result in a runtime error.

enumFrom x = enumFromTo x maxBound
enumFromThen x y = enumFromThenTo x y bound
bound | fromEnum y >= fromEnum x = maxBound
| otherwise = minBound

    Enumeration types: (), Bool, and Ordering. The semantics of these instances is given by Chapter 10. For example, [LT..] is the list [LT,EQ,GT].

For all four of these Prelude numeric types, all of the enumFrom family of functions are strict in all their arguments.

6.3.5 The Functor Class

class Functor f where
fmap :: (a -> b) -> f a -> f b

The Functor class is used for types that can be mapped over. Lists, IO, and Maybe are in this class.

Instances of Functor should satisfy the following laws:

fmap id=id
fmap (f . g)=fmap f . fmap g

All instances of Functor defined in the Prelude satisfy these laws.

6.3.6 The Monad Class

class Monad m where
(>>=) :: m a -> (a -> m b) -> m b
(>>) :: m a -> m b -> m b
return :: a -> m a
fail :: String -> m a

m >> k = m >>= \_ -> k
fail s = error s

The Monad class defines the basic operations over a monad . See Chapter 7 for more information about monads.

"do" expressions provide a convenient syntax for writing monadic expressions (see Section 3.14). The fail method is invoked on pattern-match failure in a do expression.

In the Prelude, lists, Maybe, and IO are all instances of Monad. The fail method for lists returns the empty list [], for Maybe returns Nothing, and for IO raises a user exception in the IO monad (see Section 7.3).

Instances of Monad should satisfy the following laws:

return a >>= k=k a
m >>= return=m
m >>= (x -> k x >>= h)=(m >>= k) >>= h

Instances of both Monad and Functor should additionally satisfy the law:

All instances of Monad defined in the Prelude satisfy these laws.

The Prelude provides the following auxiliary functions:

sequence :: Monad m => [m a] -> m [a]
sequence_ :: Monad m => [m a] -> m ()
mapM :: Monad m => (a -> m b) -> [a] -> m [b]
mapM_ :: Monad m => (a -> m b) -> [a] -> m ()
(=<<) :: Monad m => (a -> m b) -> m a -> m b

6.3.7 The Bounded Class

The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds. The types Int, Char, Bool, (), Ordering, and all tuples are instances of Bounded. The Bounded class may be derived for any enumeration type minBound is the first constructor listed in the data declaration and maxBound is the last. Bounded may also be derived for single-constructor datatypes whose constituent types are in Bounded.

6.4 Numbers

Haskell provides several kinds of numbers the numeric types and the operations upon them have been heavily influenced by Common Lisp and Scheme. Numeric function names and operators are usually overloaded, using several type classes with an inclusion relation shown in Figure 6.1. The class Num of numeric types is a subclass of Eq, since all numbers may be compared for equality its subclass Real is also a subclass of Ord, since the other comparison operations apply to all but complex numbers (defined in the Complex library). The class Integral contains integers of both limited and unlimited range the class Fractional contains all non-integral types and the class Floating contains all floating-point types, both real and complex.

The Prelude defines only the most basic numeric types: fixed sized integers (Int), arbitrary precision integers (Integer), single precision floating (Float), and double precision floating (Double). Other numeric types such as rationals and complex numbers are defined in libraries. In particular, the type Rational is a ratio of two Integer values, as defined in the Ratio library.

The default floating point operations defined by the Haskell Prelude do not conform to current language independent arithmetic (LIA) standards. These standards require considerably more complexity in the numeric structure and have thus been relegated to a library. Some, but not all, aspects of the IEEE floating point standard have been accounted for in Prelude class RealFloat.

The standard numeric types are listed in Table 6.1. The finite-precision integer type Int covers at least the range [ - 2 29 , 2 29 - 1] . As Int is an instance of the Bounded class, maxBound and minBound can be used to determine the exact Int range defined by an implementation. Float is implementation-defined it is desirable that this type be at least equal in range and precision to the IEEE single-precision type. Similarly, Double should cover IEEE double-precision. The results of exceptional conditions (such as overflow or underflow) on the fixed-precision numeric types are undefined an implementation may choose error ( _|_ , semantically), a truncated value, or a special value such as infinity, indefinite, etc.

Type Class Description
Integer Integral Arbitrary-precision integers
Int Integral Fixed-precision integers
(Integral a) => Ratio a RealFrac Rational numbers
Float RealFloat Real floating-point, single precision
Double RealFloat Real floating-point, double precision
(RealFloat a) => Complex a Floating Complex floating-point

Table 2

Standard Numeric Types

The standard numeric classes and other numeric functions defined in the Prelude are shown in Figures 6.2--6.3. Figure 6.1 shows the class dependencies and built-in types that are instances of the numeric classes.

class (Num a, Ord a) => Real a where
toRational :: a -> Rational

class (Real a, Enum a) => Integral a where
quot, rem, div, mod :: a -> a -> a
quotRem, divMod :: a -> a -> (a,a)
toInteger :: a -> Integer

class (Num a) => Fractional a where
(/) :: a -> a -> a
recip :: a -> a
fromRational :: Rational -> a

Figure 6

Standard Numeric Classes and Related Operations, Part 1

class (RealFrac a, Floating a) => RealFloat a where
floatRadix :: a -> Integer
floatDigits :: a -> Int
floatRange :: a -> (Int,Int)
decodeFloat :: a -> (Integer,Int)
encodeFloat :: Integer -> Int -> a
exponent :: a -> Int
significand :: a -> a
scaleFloat :: Int -> a -> a
isNaN, isInfinite, isDenormalized, isNegativeZero, isIEEE
:: a -> Bool
atan2 :: a -> a -> a

gcd, lcm :: (Integral a) => a -> a-> a
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a

Figure 7

Standard Numeric Classes and Related Operations, Part 2

6.4.1 Numeric Literals

The syntax of numeric literals is given in Section 2.5. An integer literal represents the application of the function fromInteger to the appropriate value of type Integer. Similarly, a floating literal stands for an application of fromRational to a value of type Rational (that is, Ratio Integer). Given the typings:

fromInteger :: (Num a) => Integer -> a
fromRational :: (Fractional a) => Rational -> a

integer and floating literals have the typings (Num a) => a and (Fractional a) => a, respectively. Numeric literals are defined in this indirect way so that they may be interpreted as values of any appropriate numeric type. See Section 4.3.4 for a discussion of overloading ambiguity.

6.4.2 Arithmetic and Number-Theoretic Operations

The infix class methods (+), (*), (-), and the unary function negate (which can also be written as a prefix minus sign see section 3.4) apply to all numbers. The class methods quot, rem, div, and mod apply only to integral numbers, while the class method (/) applies only to fractional ones. The quot, rem, div, and mod class methods satisfy these laws if y is non-zero:

(x `quot` y)*y + (x `rem` y) == x
(x `div` y)*y + (x `mod` y) == x

`quot` is integer division truncated toward zero, while the result of `div` is truncated toward negative infinity. The quotRem class method takes a dividend and a divisor as arguments and returns a (quotient, remainder) pair divMod is defined similarly:

even x = x `rem` 2 == 0
odd = not . even

Finally, there are the greatest common divisor and least common multiple functions. gcd x y is the greatest (positive) integer that divides both x and y for example gcd (-3) 6 = 3, gcd (-3) (-6) = 3, gcd 0 4 = 4. gcd 0 0 raises a runtime error.

lcm x y is the smallest positive integer that both x and y divide.

6.4.3 Exponentiation and Logarithms

The one-argument exponential function exp and the logarithm function log act on floating-point numbers and use base e . logBase a x returns the logarithm of x in base a . sqrt returns the principal square root of a floating-point number. There are three two-argument exponentiation operations: (^) raises any number to a nonnegative integer power, (^^) raises a fractional number to any integer power, and (**) takes two floating-point arguments. The value of x ^0 or x ^^0 is 1 for any x , including zero 0** y is undefined.

6.4.4 Magnitude and Sign

A number has a magnitude and a sign . The functions abs and signum apply to any number and satisfy the law:

signum x | x > 0 = 1
| x == 0 = 0
| x < 0 = -1

6.4.5 Trigonometric Functions

Class Floating provides the circular and hyperbolic sine, cosine, and tangent functions and their inverses. Default implementations of tan, tanh, logBase, **, and sqrt are provided, but implementors are free to provide more accurate implementations.

Class RealFloat provides a version of arctangent taking two real floating-point arguments. For real floating x and y , atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y) . atan2 y x returns a value in the range [-pi, pi]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1, with y in a type that is RealFloat, should return the same value as atan y . A default definition of atan2 is provided, but implementors can provide a more accurate implementation.

The precise definition of the above functions is as in Common Lisp, which in turn follows Penfield's proposal for APL [9]. See these references for discussions of branch cuts, discontinuities, and implementation.

6.4.6 Coercions and Component Extraction

The ceiling, floor, truncate, and round functions each take a real fractional argument and return an integral result. ceiling x returns the least integer not less than x , and floor x , the greatest integer not greater than x . truncate x yields the integer nearest x between 0 and x , inclusive. round x returns the nearest integer to x , the even integer if x is equidistant between two integers.

The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f , and: n is an integral number with the same sign as x and f is a fraction f with the same type and sign as x , and with absolute value less than 1. The ceiling, floor, truncate, and round functions can be defined in terms of properFraction.

Two functions convert numbers to type Rational: toRational returns the rational equivalent of its real argument with full precision approxRational takes two real fractional arguments x and e and returns the simplest rational number within e of x , where a rational p/q in reduced form is simpler than another p ' / q ' if |p| <=|p ' | and q <=q ' . Every real interval contains a unique simplest rational in particular, note that 0/1 is the simplest rational of all.

The class methods of class RealFloat allow efficient, machine-independent access to the components of a floating-point number. The functions floatRadix, floatDigits, and floatRange give the parameters of a floating-point type: the radix of the representation, the number of digits of this radix in the significand, and the lowest and highest values the exponent may assume, respectively. The function decodeFloat applied to a real floating-point number returns the significand expressed as an Integer and an appropriately scaled exponent (an Int). If decodeFloat x yields ( m , n ), then x is equal in value to mb n , where b is the floating-point radix, and furthermore, either m and n are both zero or else b d-1 <=m<b d , where d is the value of floatDigits x. encodeFloat performs the inverse of this transformation. The functions significand and exponent together provide the same information as decodeFloat, but rather than an Integer, significand x yields a value of the same type as x, scaled to lie in the open interval (-1,1) . exponent 0 is zero. scaleFloat multiplies a floating-point number by an integer power of the radix.

The functions isNaN, isInfinite, isDenormalized, isNegativeZero, and isIEEE all support numbers represented using the IEEE standard. For non-IEEE floating point numbers, these may all return false.

Also available are the following coercion functions:

fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b

The Haskell 98 Report
top | back | next | contents | function index
December 2002


To make life easier, MATLAB includes many standard functions. Each function is a block of code that accomplishes a specific task. MATLAB contains all of the standard functions such as sin, cos, log, exp, sqrt, as well as many others. Commonly used constants such as pi, and i or j for the square root of -1, are also incorporated into MATLAB.

To determine the usage of any function, type help [function name] at the MATLAB command window.

MATLAB even allows you to write your own functions with the function command follow the link to learn how to write your own functions and see a listing of the functions we created for this tutorial.

What are the types of Discontinuities?

The graph of $f(x)$ below shows a function that is discontinuous at $x = a$.

In this graph, you can easily see that $ limlimits_ f(x) = L> % mbox < and >% limlimits_ f(x) = M>. $

The function is approaching different values depending on the direction $x$ is coming from. When this happens, we say the function has a jump discontinuity at $x=a$.

Infinite Discontinuities

The graph below shows a function that is discontinuous at $x=a$.

The arrows on the function indicate it will grow infinitely large as $x$ approaches $a$. Since the function doesn't approach a particular finite value, the limit does not exist. This is an infinite discontinuity.

The following two graphs are also examples of infinite discontinuities at $x = a$. Notice that in all three cases, both of the one-sided limits are infinite.

Removable Discontinuities

In the graphs below, there is a hole in the function at $x=a$. These holes are called removable discontinuities

Notice that for both graphs, even though there are holes at $x = a$, the limit value at $x=a$ exists.

Removable Discontinuities can be Fixed

Removable discontinuities can be fixed by redefining the function, as shown in the following example.


The function below has a removable discontinuity at $x = 2$. Redefine the function so that it becomes continuous at $x=2$.

The graph of the function is shown below for reference.

In order to fix the discontinuity, we need to know the $y$-value of the hole in the graph. To determine this, we find the value of $limlimits_ f(x)$.

Examining the form of the limit we see

The division by zero in the $frac 0 0$ form tells us there is definitely a discontinuity at this point.

Next, using the techniques covered in previous lessons (see Indeterminate Limits---Factorable) we can easily determine

$displaystylelim_ f(x) = frac 1 2$

The limit value is also the $y$-value of the hole in the graph. Now we can redefine the original function in a piecewise form:

The first piece preserves the overall behavior of the function, while the second piece plugs the hole.

Endpoint Discontinuities

When a function is defined on an interval with a closed endpoint, the limit cannot exist at that endpoint. This is because the limit has to examine the function values as $x$ approaches from both sides.

For example, consider finding $displaystylelimlimits_ sqrt x$ (see the graph below).

Note that $x=0$ is the left-endpoint of the functions domain: $[0,infty)$, and the function is technically not continuous there because the limit doesn't exist (because $x$ can't approach from both sides).

We should note that the function is right-hand continuous at $x=0$ which is why we don't see any jumps, or holes at the endpoint.

Mixed Discontinuities

Consider the graph shown below.

The function is obviously discontinuous at $x = 3$. From the left, the function has an infinite discontinuity, but from the right, the discontinuity is removable. Since there is more than one reason why the discontinuity exists, we say this is a mixed discontinuity


Glycosaminoglycans vary greatly in molecular mass, disaccharide construction, and sulfation. This is because GAG synthesis is not template driven like proteins or nucleic acids, but constantly altered by processing enzymes. [4]

GAGs are classified into four groups based on core disaccharide structures. [5] Heparin/heparan sulfate (HSGAGs) and chondroitin sulfate/dermatan sulfate (CSGAGs) are synthesized in the Golgi apparatus, where protein cores made in the rough endoplasmic reticulum are post-translationally modified with O-linked glycosylations by glycosyltransferases forming proteoglycans. Keratan sulfate may modify core proteins through N-linked glycosylation or O-linked glycosylation of the proteoglycan. The fourth class of GAG, hyaluronic acid is synthesized by integral membrane synthases which immediately secrete the dynamically elongated disaccharide chain.


HSGAG and CSGAG modified proteoglycans first begin with a consensus Ser-Gly/Ala-X-Gly motif in the core protein. Construction of a tetrasaccharide linker that consists of -GlcAβ1–3Galβ1–3Galβ1–4Xylβ1-O-(Ser)-, where xylosyltransferase, β4-galactosyl transferase (GalTI),β3-galactosyl transferase (GalT-II), and β3-GlcA transferase (GlcAT-I) transfer the four monosaccharides, begins synthesis of the GAG modified protein. The first modification of the tetrasaccharide linker determines whether the HSGAGs or CSGAGs will be added. Addition of a GlcNAc promotes the addition of HSGAGs while addition of GalNAc to the tetrasaccharide linker promotes CSGAG development. [5] GlcNAcT-I transfers GlcNAc to the tetrasaccahride linker, which is distinct from glycosyltransferase GlcNAcT-II, the enzyme that is utilized to build HSGAGs. EXTL2 and EXTL3, two genes in the EXT tumor suppressor family, have been shown to have GlcNAcT-I activity. Conversely, GalNAc is transferred to the linker by the enzyme GalNAcT to initiate synthesis of CSGAGs, an enzyme which may or may not have distinct activity compared to the GalNAc transferase activity of chondroitin synthase. [5]

With regard to HSGAGs, a multimeric enzyme encoded by EXT1 and EXT2 of the EXT family of genes, transfers both GlcNAc and GlcA for HSGAG chain elongation. While elongating, the HSGAG is dynamically modified, first by N-deacetylase, N-sulfotransferase (NDST1), which is a bifunctional enzyme that cleaves the N-acetyl group from GlcNAc and subsequently sulfates the N-position. Next, C-5 uronyl epimerase coverts d-GlcA to l-IdoA followed by 2-O sulfation of the uronic acid sugar by 2-O sulfotransferase (Heparan sulfate 2-O-sulfotransferase). Finally, the 6-O and 3-O positions of GlcNAc moities are sulfated by 6-O (Heparan sulfate 6-O-sulfotransferase) and 3-O (3-OST) sulfotransferases.

Chondroitin sulfate and dermatan sulfate, which comprise CSGAGs, are differentiated from each other by the presence of GlcA and IdoA epimers respectively. Similar to the production of HSGAGs, C-5 uronyl epimerase converts d-GlcA to l-IdoA to synthesize dermatan sulfate. Three sulfation events of the CSGAG chains occur: 4-O and/or 6-O sulfation of GalNAc and 2-O sulfation of uronic acid. Four isoforms of the 4-O GalNAc sulfotransferases (C4ST-1, C4ST-2, C4ST-3, and D4ST-1) and three isoforms of the GalNAc 6-O sulfotransferases (C6ST, C6ST-2, and GalNAc4S-6ST) are responsible for the sulfation of GalNAc. [6]

Keratan sulfate types Edit

Unlike HSGAGs and CSGAGs, the third class of GAGs, those belonging to keratan sulfate types, are driven towards biosynthesis through particular protein sequence motifs. For example, in the cornea and cartilage, the keratan sulfate domain of aggrecan consists of a series of tandemly repeated hexapeptides with a consensus sequence of E(E/L)PFPS. [7] Additionally, for three other keratan sulfated proteoglycans, lumican, keratocan, and mimecan (OGN), the consensus sequence NX(T/S) along with protein secondary structure was determined to be involved in N-linked oligosaccharide extension with keratan sulfate. [7] Keratan sulfate elongation begins at the nonreducing ends of three linkage oligosaccharides, which define the three classes of keratan sulfate. Keratan sulfate I (KSI) is N -linked via a high mannose type precursor oligosaccharide. Keratan sulfate II (KSII) and keratan sulfate III (KSIII) are O-linked, with KSII linkages identical to that of mucin core structure, and KSIII linked to a 2-O mannose. Elongation of the keratan sulfate polymer occurs through the glycosyltransferase addition of Gal and GlcNAc. Galactose addition occurs primarily through the β-1,4-galactosyltransferase enzyme (β4Gal-T1) while the enzymes responsible for β-3-Nacetylglucosamine have not been clearly identified. Finally, sulfation of the polymer occurs at the 6-position of both sugar residues. The enzyme KS-Gal6ST (CHST1) transfers sulfate groups to galactose while N-acetylglucosaminyl-6-sulfotransferase (GlcNAc6ST) (CHST2) transfers sulfate groups to terminal GlcNAc in keratan sulfate. [8]

Hyaluronic acid Edit

The fourth class of GAG, hyaluronic acid, is not sulfated and is synthesized by three transmembrane synthase proteins HAS1, HAS2, and HAS3. HA, a linear polysaccharide, is composed of repeating disaccharide units of →4)GlcAβ(1→3)GlcNAcβ(1→ and has a very high molecular mass, ranging from 10 5 to 10 7 Da. Each HAS enzyme is capable of transglycosylation when supplied with UDP-GlcA and UDP-GlcNAc. [9] [10] HAS2 is responsible for very large hyaluronic acid polymers, while smaller sizes of HA are synthesized by HAS1 and HAS3. While each HAS isoform catalyzes the same biosynthetic reaction, each HAS isoform is independently active. HAS isoforms have also been shown to have differing Km values for UDP-GlcA and UDPGlcNAc. [11] It is believed that through differences in enzyme activity and expression, the wide spectrum of biological functions mediated by HA can be regulated, such as its involvement with neural stem cell regulation in the subgranular zone of the brain.

CSGAGs interact with heparin binding proteins, specifically dermatan sulfate interactions with fibroblast growth factor FGF-2 and FGF-7 have been implicated in cellular proliferation and wound repair [15] while interactions with hepatic growth factor/scatter factor (HGF/SF) activate the HGF/SF signaling pathway (c-Met) through its receptor. CASGAGs are important in providing support and adhesiveness in bone, skin, and cartilage. Other biological functions for which CSGAGs are known to play critical functions in include inhibition of axonal growth and regeneration in CNS development, roles in brain development, neuritogenic activity, and pathogen infection. [16]

Keratan sulfates One of the main functions of the third class of GAGs, keratan sulfates, is the maintenance of tissue hydration. [17] Keratan sulfates are in the bone, cartilage, and the cornea of the eye. [18] Within the normal cornea, dermatan sulfate is fully hydrated whereas keratan sulfate is only partially hydrated suggesting that keratan sulfate may behave as a dynamically controlled buffer for hydration. [17] In disease states such as macular corneal dystrophy, in which GAGs levels such as KS are altered, loss of hydration within the corneal stroma is believed to be the cause of corneal haze, thus supporting the long-held hypothesis that corneal transparency is a dependent on proper levels of keratan sulfate. Keratan sulfate GAGs are found in many other tissues besides the cornea, where they are known to regulate macrophage adhesion, form barriers to neurite growth, regulate embryo implantation in the endometrial uterine lining during menstrual cycles, and affect the motility of corneal endothelial cells. [17] In summary, KS plays an anti-adhesive role, which suggests very important functions of KS in cell motility and attachment as well as other potential biological processes.

Dermatan sulfates function in the skin, tendons, blood vessels, and heart valves. [18]

Hyaluronic acid Hyaluronic acid is a major component of synovial tissues and fluid, as well as the ground substance of other connective tissues. Hyaluronic acid binds cells together, lubricates joints, and helps maintain the shape of the eyeballs. [18] :The viscoelasticity of hyaluronic acid make it ideal for lubricating joints and surfaces that move along each other, such as cartilage. A solution of hyaluronic acid under low shear stress has a much higher viscosity than while under high shear stress. [19] Hyaluronidase, an enzyme produced by white blood cells, sperms cells, and some bacteria, breaks apart the hyaluronic acid, causing the solution to become more liquid. [18] In vivo, hyaluronic acid forms randomly kinked coils that entangle to form a hyaluronan network, slowing diffusion and forming a diffusion barrier that regulates transport of substances between cells. For example, hyaluronan helps partition plasma proteins between vascular and extravascular spaces, which affects solubility of macromolecules in the interstitium, changes chemical equilibria, and stabilizes the structure of collagen fibers. [19] Other functions include matrix interactions with hyaluronan binding proteins such as hyaluronectin, glial hyaluronan binding protein, brain enriched hyaluronan binding protein, collagen VI, TSG-6, and inter-alpha-trypsin inhibitor. Cell surface interactions involving hyaluronan are its well-known coupling with CD44, which may be related to tumor progression, and also with RHAMM (Hyaluronan-mediated motility receptor), which has been implicated in developmental processes, tumor metastasis, and pathological reparative processes. Fibroblasts, mesothelial cells, and certain types of stem cells surround themselves in a pericellular "coat", part of which is constructed from hyaluronan, in order to shield themselves from bacteria, red blood cells, or other matrix molecules. For example, with regards to stem cells, hyaluronan, along with chondroitin sulfate, helps to form the stem cell niche. Stem cells are protected from the effects of growth factors by a shield of hyaluronan and minimally sulfated chondroitin sulfate. During progenitor division, the daughter cell moves outside of this pericellular shield where it can then be influenced by growth factors to differentiate even further.

The Nature of Managerial Work

Managers are responsible for the processes of getting activities completed efficiently with and through other people and setting and achieving the firm’s goals through the execution of four basic management functions: planning, organizing, leading, and controlling. Both sets of processes utilize human, financial, and material resources.

Of course, some managers are better than others at accomplishing this! There have been a number of studies on what managers actually do, the most famous of those conducted by Professor Henry Mintzberg in the early 1970s (Mintzberg, 1973). One explanation for Mintzberg’s enduring influence is perhaps that the nature of managerial work has changed very little since that time, aside from the shift to an empowered relationship between top managers and other managers and employees, and obvious changes in technology, and the exponential increase in information overload.

After following managers around for several weeks, Mintzberg concluded that, to meet the many demands of performing their functions, managers assume multiple roles. A role is an organized set of behaviors, and Mintzberg identified 10 roles common to the work of all managers. As summarized in the following figure, the 10 roles are divided into three groups: interpersonal, informational, and decisional. The informational roles link all managerial work together. The interpersonal roles ensure that information is provided. The decisional roles make significant use of the information. The performance of managerial roles and the requirements of these roles can be played at different times by the same manager and to different degrees, depending on the level and function of management. The 10 roles are described individually, but they form an integrated whole.

The three interpersonal roles are primarily concerned with interpersonal relationships. In the figurehead role, the manager represents the organization in all matters of formality. The top-level manager represents the company legally and socially to those outside of the organization. The supervisor represents the work group to higher management and higher management to the work group. In the liaison role, the manager interacts with peers and people outside the organization. The top-level manager uses the liaison role to gain favors and information, while the supervisor uses it to maintain the routine flow of work. The leader role defines the relationships between the manager and employees.

The direct relationships with people in the interpersonal roles place the manager in a unique position to get information. Thus, the three informational roles are primarily concerned with the information aspects of managerial work. In the monitor role, the manager receives and collects information. In the role of disseminator, the manager transmits special information into the organization. The top-level manager receives and transmits more information from people outside the organization than the supervisor. In the role of spokesperson, the manager disseminates the organization’s information into its environment. Thus, the top-level manager is seen as an industry expert, while the supervisor is seen as a unit or departmental expert.

The unique access to information places the manager at the center of organizational decision making. There are four decisional roles managers play. In the entrepreneur role, the manager initiates change. In the disturbance handler role, the manager deals with threats to the organization. In the resource allocator role, the manager chooses where the organization will expend its efforts. In the negotiator role, the manager negotiates on behalf of the organization. The top-level manager makes the decisions about the organization as a whole, while the supervisor makes decisions about his or her particular work unit.

The supervisor performs these managerial roles but with different emphasis than higher managers. Supervisory management is more focused and short-term in outlook. Thus, the figurehead role becomes less significant and the disturbance handler and negotiator roles increase in importance for the supervisor. Since leadership permeates all activities, the leader role is among the most important of all roles at all levels of management.

So what do Mintzberg’s conclusions about the nature of managerial work mean for you? On the one hand, managerial work is the lifeblood of most organizations because it serves to choreograph and motivate individuals to do amazing things. Managerial work is exciting, and it is hard to imagine that there will ever be a shortage of demand for capable, energetic managers. On the other hand, managerial work is necessarily fast-paced and fragmented, where managers at all levels express the opinion that they must process much more information and make more decisions than they could have ever possibly imagined. So, just as the most successful organizations seem to have well-formed and well-executed strategies, there is also a strong need for managers to have good strategies about the way they will approach their work. This is exactly what you will learn through principles of management.

Key Takeaway

Managers are responsible for getting work done through others. We typically describe the key managerial functions as planning, organizing, leading, and controlling. The definitions for each of these have evolved over time, just as the nature of managing in general has evolved over time. This evolution is best seen in the gradual transition from the traditional hierarchical relationship between managers and employees, to a climate characterized better as an upside-down pyramid, where top executives support middle managers and they, in turn, support the employees who innovate and fulfill the needs of customers and clients. Through all four managerial functions, the work of managers ranges across 10 roles, from figurehead to negotiator. While actual managerial work can seem challenging, the skills you gain through principles of management—consisting of the functions of planning, organizing, leading, and controlling—will help you to meet these challenges.


  1. Why do organizations need managers?
  2. What are some different types of managers and how do they differ?
  3. What are Mintzberg’s 10 managerial roles?
  4. What three areas does Mintzberg use to organize the 10 roles?
  5. What four general managerial functions do principles of management include?

The Existence of a Limit

As we consider the limit in the next example, keep in mind that for the limit of a function to exist at a point, the functional values must approach a single real-number value at that point. If the functional values do not approach a single value, then the limit does not exist.

Evaluating a Limit That Fails to Exist

Evaluate using a table of values.


(Figure) lists values for the function for the given values of .

Table of Functional Values for
−0.1 0.544021110889 0.1 −0.544021110889
−0.01 0.50636564111 0.01 −0.50636564111
−0.001 −0.8268795405312 0.001 0.826879540532
−0.0001 0.305614388888 0.0001 −0.305614388888
−0.00001 −0.035748797987 0.00001 0.035748797987
−0.000001 0.349993504187 0.000001 −0.349993504187

After examining the table of functional values, we can see that the -values do not seem to approach any one single value. It appears the limit does not exist. Before drawing this conclusion, let’s take a more systematic approach. Take the following sequence of -values approaching 0:

The corresponding -values are

At this point we can indeed conclude that does not exist. (Mathematicians frequently abbreviate “does not exist” as DNE. Thus, we would write DNE.) The graph of is shown in (Figure) and it gives a clearer picture of the behavior of as approaches 0. You can see that oscillates ever more wildly between −1 and 1 as approaches 0.

Figure 6. The graph of oscillates rapidly between −1 and 1 as x approaches 0.

Use a table of functional values to evaluate , if possible.


does not exist.

Use -values 1.9, 1.99, 1.999, 1.9999, 1.9999 and 2.1, 2.01, 2.001, 2.0001, 2.00001 in your table.

As the name suggests, here the functions are defined outside the class however they are declared inside the class.

Functions should be declared inside the class to bound it to the class and indicate it as it’s member but they can be defined outside of the class.

To define a function outside of a class, scope resolution operator :: is used.

Syntax for declaring function outside of class

Here is this program, the functions showdata() and getdata() are declared inside the class and defined outside the class. This is achieved by using scope resolution operator :: .

Basic Excel Formulas

Mastering the basic Excel formulas is critical for beginners to become highly proficient in financial analysis Financial Analyst Job Description The financial analyst job description below gives a typical example of all the skills, education, and experience required to be hired for an analyst job at a bank, institution, or corporation. Perform financial forecasting, reporting, and operational metrics tracking, analyze financial data, create financial models . Microsoft Excel Excel Resources Learn Excel online with 100's of free Excel tutorials, resources, guides & cheat sheets! CFI's resources are the best way to learn Excel on your own terms. is considered the industry standard piece of software in data analysis. Microsoft&rsquos spreadsheet program also happens to be one of the most preferred software by investment bankers Investment Banking Job Description This Investment Banking Job description outlines the main skills, education, and work experience required to become an IB analyst or associate and financial analysts in data processing, financial modeling What is Financial Modeling Financial modeling is performed in Excel to forecast a company's financial performance. Overview of what is financial modeling, how & why to build a model. , and presentation. This guide will provide an overview and list of basic Excel functions.

Once you&rsquove mastered this list, move on to CFI&rsquos advanced Excel formulas guide Advanced Excel Formulas Must Know These advanced Excel formulas are critical to know and will take your financial analysis skills to the next level. Download our free Excel ebook! !

Basic Terms in Excel

There are two basic ways to perform calculations in Excel: Formulas and Functions Formula vs Function A Formula is an equation designed by a user in Excel, while a Function is a predefined calculation in the spreadsheet application. This guide will walk you through Formula vs Function in Excel so you know exactly what the similarities and differences are. Excel allows users to perform simple calculations such .

1. Formulas

In Excel, a formula is an expression that operates on values in a range of cells or a cell. For example, =A1+A2+A3, which finds the sum of the range of values from cell A1 to cell A3.

2. Functions

Functions are predefined formulas in Excel. They eliminate laborious manual entry of formulas while giving them human-friendly names. For example: =SUM(A1:A3). The function sums all the values from A1 to A3.

Five Time-saving Ways to Insert Data into Excel

When analyzing data, there are five common ways of inserting basic Excel formulas. Each strategy comes with its own advantages. Therefore, before diving further into the main formulas, we&rsquoll clarify those methods, so you can create your preferred workflow earlier on.

1. Simple insertion: Typing a formula inside the cell

Typing a formula in a cell or the formula bar is the most straightforward method of inserting basic Excel formulas. The process usually starts by typing an equal sign, followed by the name of an Excel function.

Excel is quite intelligent in that when you start typing the name of the function, a pop-up function hint will show. It&rsquos from this list you&rsquoll select your preference. However, don&rsquot press the Enter key. Instead, press the Tab key so that you can continue to insert other options. Otherwise, you may find yourself with an invalid name error, often as &lsquo#NAME?&rsquo. To fix it, just re-select the cell, and go to the formula bar to complete your function.

2. Using Insert Function Option from Formulas Tab

If you want full control of your functions insertion, using the Excel Insert Function dialogue box is all you ever need. To achieve this, go to the Formulas tab and select the first menu labeled Insert Function. The dialogue box will contain all the functions you need to complete your financial analysis Types of Financial Analysis Financial analysis involves using financial data to assess a company&rsquos performance and make recommendations about how it can improve going forward. Financial Analysts primarily carry out their work in Excel, using a spreadsheet to analyze historical data and make projections Types of Financial Analysis .

3. Selecting a Formula from One of the Groups in Formula Tab

This option is for those who want to delve into their favorite functions quickly. To find this menu, navigate to the Formulas tab and select your preferred group. Click to show a sub-menu filled with a list of functions. From there, you can select your preference. However, if you find your preferred group is not on the tab, click on the More Functions option &ndash it&rsquos probably just hidden there.

4. Using AutoSum Option

For quick and everyday tasks, the AutoSum function Autosum The autosum Excel formula is a shortcut that can save time in financial modeling in Excel. Type "ALT lazy" src="" srcset="" sizes="" data-src="" data-srcset="// 1024w, // 300w, // 768w, // 1200w, // 600w, // 1952w" data-sizes="(max-width: 860px) 100vw, 860px">

5. Quick Insert: Use Recently Used Tabs

If you find re-typing your most recent formula a monotonous task, then use the Recently Used menu. It&rsquos on the Formulas tab, a third menu option just next to AutoSum.

Free Excel Formulas YouTube Tutorial

Watch CFI&rsquos FREE YouTube video tutorial to quickly learn the most important Excel formulas. By watching the video demonstration you&rsquoll quickly learn the most important formulas and functions.

Seven Basic Excel Formulas For Your Workflow

Since you&rsquore now able to insert your preferred formulas and function correctly, let&rsquos check some fundamental Excel functions to get you started.

1. SUM

The SUM function SUM Function The SUM function is categorized under Math and Trigonometry functions. The function will sum up cells that are supplied as multiple arguments. It is the most popular and widely used function in Excel. SUM helps users perform a quick summation of specified cells in MS Excel. For example, we are given the cost of 100 is the first must-know formula in Excel. It usually aggregates values from a selection of columns or rows from your selected range.

=SUM(number1, [number2], &hellip)

=SUM(B2:G2) &ndash A simple selection that sums the values of a row.

=SUM(A2:A8) &ndash A simple selection that sums the values of a column.

=SUM(A2:A7, A9, A12:A15) &ndash A sophisticated collection that sums values from range A2 to A7, skips A8, adds A9, jumps A10 and A11, then finally adds from A12 to A15.

=SUM(A2:A8)/20 &ndash Shows you can also turn your function into a formula.


The AVERAGE function AVERAGE Function Calculate Average in Excel. The AVERAGE function is categorized under Statistical functions. It will return the average of the arguments. It is used to calculate the arithmetic mean of a given set of arguments. As a financial analyst, the function is useful in finding out the average of numbers. should remind you of simple averages of data such as the average number of shareholders in a given shareholding pool.

=AVERAGE(number1, [number2], &hellip)

=AVERAGE(B2:B11) &ndash Shows a simple average, also similar to (SUM(B2:B11)/10)


The COUNT function COUNT Function The COUNT Function is an Excel Statistical function. This function helps count the number of cells that contain a number, as well as the number of arguments that contain numbers. It will also count numbers in any given array. It was introduced in Excel in 2000. As a financial analyst, it is useful in analyzing data counts all cells in a given range that contain only numeric values.

=COUNT(value1, [value2], &hellip)

COUNT(A:A) &ndash Counts all values that are numerical in A column. However, you must adjust the range inside the formula to count rows.

COUNT(A1:C1) &ndash Now it can count rows.


Like the COUNT function, COUNTA COUNTA Function The COUNTA Function will calculate the number of cells that are not blank within a given set of values. The =counta() function is also commonly referred to as the Excel Countif Not Blank formula. As a financial analyst, the function is useful count cells that are not blank or empty in a given range. counts all cells in a given rage. However, it counts all cells regardless of type. That is, unlike COUNT that only counts numerics, it also counts dates, times, strings, logical values, errors, empty string, or text.

=COUNTA(value1, [value2], &hellip)

COUNTA(C2:C13) &ndash Counts rows 2 to 13 in column C regardless of type. However, like COUNT, you can&rsquot use the same formula to count rows. You must make an adjustment to the selection inside the brackets &ndash for example, COUNTA(C2:H2) will count columns C to H

The IF function IF Function The Excel IF Statement function tests a given condition and returns one value for a TRUE result, and another for a FALSE result. For example, if sales total more than $5,000, then return a "Yes" for Bonus, else, return a "No". We can also create nested IF statements is often used when you want to sort your data according to a given logic. The best part of the IF formula is that you can embed formulas and function in it.

=IF(logical_test, [value_if_true], [value_if_false])

=IF(C2<D3, &lsquoTRUE,&rsquo &lsquoFALSE&rsquo) &ndash Checks if the value at C3 is less than the value at D3. If the logic is true, let the cell value be TRUE, else, FALSE

=IF(SUM(C1:C10) > SUM(D1:D10), SUM(C1:C10), SUM(D1:D10)) &ndash An example of a complex IF logic. First, it sums C1 to C10 and D1 to D10, then it compares the sum. If the sum of C1 to C10 is greater than the sum of D1 to D10, then it makes the value of a cell equal to the sum of C1 to C10. Otherwise, it makes it the SUM of C1 to C10.


The TRIM function TRIM Function The TRIM function is categorized under Excel Text functions. TRIM helps remove the extra spaces in data and thus clean up the cells in the worksheet. In financial analysis, the TRIM function can be useful in removing irregular makes sure your functions do not return errors due to unruly spaces. It ensures that all empty spaces are eliminated. Unlike other functions that can operate on a range of cells, TRIM only operates on a single cell. Therefore, it comes with the downside of adding duplicated data in your spreadsheet.

TRIM(A2) &ndash Removes empty spaces in the value in cell A2.

7. MAX & MIN

The MAX MAX Function The MAX Function is categorized under Excel Statistical functions. MAX will return the largest value in a given list of arguments. From a given set of numeric values, it will return the highest value. Unlike MAXA function, the MAX function will count numbers but ignore empty cells and MIN MIN Function The MIN function is categorized under Excel Statistical functions. MIN will return the minimum value in a given list of arguments. From a given set of numeric values, it will return the smallest value. Unlike the MINA function functions help in finding the maximum number and the minimum number in a range of values.

=MIN(number1, [number2], &hellip)

=MIN(B2:C11) &ndash Finds the minimum number between column B from B2 and column C from C2 to row 11 in both columns B and C.

=MAX(number1, [number2], &hellip)

=MAX(B2:C11) &ndash Similarly, it finds the maximum number between column B from B2 and column C from C2 to row 11 in both columns B and C.

More Resources

Thank you for reading CFI&rsquos guide to basic Excel formulas. To continue your development as a world-class financial analyst Become a Certified Financial Modeling & Valuation Analyst (FMVA)® CFI's Financial Modeling and Valuation Analyst (FMVA)® certification will help you gain the confidence you need in your finance career. Enroll today! , these additional CFI resources will be helpful:

  • Advanced Excel Formulas Advanced Excel Formulas Must Know These advanced Excel formulas are critical to know and will take your financial analysis skills to the next level. Download our free Excel ebook!
  • Benefits of Excel Shortcuts Excel Shortcuts Overview Excel shortcuts are an overlooked method of increasing productivity and speed within Excel. Excel shortcuts offer the financial analyst a powerful tool. These shortcuts can perform many functions. as simple as navigation within the spreadsheet to filling in formulas or grouping data.
  • List of Excel Functions Functions List of the most important Excel functions for financial analysts. This cheat sheet covers 100s of functions that are critical to know as an Excel analyst
  • Valuation Modeling Excel Valuation Modeling in Excel Valuation modeling in Excel may refer to several different types of analysis, including discounted cash flow (DCF) analysis, comparable trading multiples

Free Excel Tutorial

To master the art of Excel, check out CFI&rsquos FREE Excel Crash Course, which teaches you how to become an Excel power user. Learn the most important formulas, functions, and shortcuts to become confident in your financial analysis.