---
# System prepended metadata

title: Project 2 with Examples
tags: [projects]

---

# Question 1. A coffee shop increased recently its price for a latte from $4 per cup to $5. In reaction, the number of lattes sold per day dropped from 40 to 30. It costs the shop about a $1 to make a cup of latte in addition to daily fixed cost of $32.5 to maintain the equipment.

## a. Find the price-demand equation for latte and its domain, assuming there is a linear relationship.

<details> <summary> Example: </summary>

A coffee shop increased recently its price for a latte from $3 per cup to $4. In reaction, the number of lattes sold per day dropped from 50 to 45. It costs the shop about a $1.25 to make a cup of latte in addition to daily fixed cost of $26.50 to maintain the equipment. 

a. Find the price-demand equation for latte and its domain, assuming there is a linear relationship.
    
To express the price $p$ as a function of the quantity demanded $x$, we use the linear relationship form:

$$
p=mx+b
$$

Where:
- $p$ is the price per latte,
- $x$ is the quantity demanded (number of lattes sold per day),
- $m$ is the slope,
- $b$ is the y-intercept.

### Step 1: Find the slope ($m$)

The slope $m$ represents the rate of change of price with respect to the quantity demanded. From the data provided:

- When the quantity demanded is $50 (x_1=50)$, the price is $3 (p_1=3)$,
- When the quantity demanded is $45 (x_2=45)$, the price is $4 (p_2=4)$.

The slope is given by:

$$
m=\frac{p_2-p_1}{x_2-x_1}
$$

Substitute the values:

$$
m=\frac{4-3}{45-50}=\frac{1}{-5}=-\frac{1}{5}
$$

### Step 2: Find the y-intercept ($b$)

Now that we know the slope, we can substitute one of the points to solve for the y-intercept $b$. Using the point $(x_1=50,p_1=3)$:

    
$$p=mx+b$$
Plugging $p,m,x$ in:
$$
3=-\frac{1}{5}(50)+b
$$

$$
3=-10+b
$$

$$
b=13
$$

### Step 3: Write the price-demand equation

Now that we have both the slope and the intercept, we can write the price-demand equation:

$$
p=-\frac{1}{5}x+13
$$

### Step 4: Determine the domain

The domain of the price-demand equation is the range of values for $x$ such that the price $p$ is non-negative ($p\geq0$).

From the equation $p=-\frac{1}{5}x+13$, we require:

$$
-\frac{1}{5}x+13\geq0
$$

$$
-\frac{1}{5}x\geq-13
$$

$$
x\leq65
$$

Since the quantity demanded must also be non-negative, we have:

$$
x\geq0
$$

Thus, the domain is:

$$
0\leq x\leq 65
$$

### Final Answer:

- The price-demand equation is:

$$
p=-\frac{1}{5}x+13
$$

- The domain of the equation is $0\leq x\leq 65$.



</details>

## b. Find the daily cost function, as a function of the number of latte coffees made.

<details> <summary> Example: </summary>

The daily cost function includes both the fixed costs and the variable costs associated with producing lattes. The fixed costs are constant, while the variable costs depend on the number of lattes made.

### Step 1: Fixed costs

The shop has a fixed daily cost of $26.50 to maintain the equipment. This cost does not depend on the number of lattes made.

### Step 2: Variable costs

It costs the shop $1.25 to make each latte. If $x$ represents the number of lattes made, the total variable cost is $1.25 \times x = 1.25x$.

### Step 3: Write the cost function

The total daily cost function $C(x)$ is the sum of the fixed costs and the variable costs:

$$
C(x) = \text{Fixed Cost} + \text{Variable Cost}
$$

Substitute the values:

$$
C(x) = 26.50 + 1.25x
$$


### Final Answer:

The daily cost function is:

$$
C(x) = 1.25x + 26.50
$$



</details>

## c. Find the revenue function $R(x)$ and its domain.

<details> <summary> Example: </summary>

The revenue function represents the total money earned from selling $x$ lattes. The revenue depends on the price per latte and the number of lattes sold.

### Step 1: Price-demand equation

From the previous solution, the price per latte as a function of the number of lattes sold $x$ is given by:

$$
p = -\frac{1}{5}x + 13
$$

### Step 2: Revenue function

Revenue is calculated by multiplying the price per latte by the number of lattes sold. The revenue function $R(x)$ is:

$$
R(x) = p \times x
$$

Substitute the price function $p$:

$$
R(x) = \left(-\frac{1}{5}x + 13\right) \times x
$$

Simplify:

$$
R(x) = -\frac{1}{5}x^2 + 13x
$$

### Step 3: Determine the domain

The domain of the revenue function is determined by the price-demand function's domain, which was found to be:

$$
0 \leq x \leq 65
$$

### Final Answer:

The revenue function is:

$$
R(x) = -\frac{1}{5}x^2 + 13x
$$

The domain of the revenue function is:

$$
0 \leq x \leq 65
$$


</details>

## d. Plot $R(x)$ and $C(x)$, find the break–even points and verify your result in the plot.

<details> <summary> Example: </summary>

![image](https://hackmd.io/_uploads/ByPCV7i1ye.png)

### Step 1: Revenue Function $R(x)$

The revenue function is given by:

$$
R(x) = -\frac{1}{5}x^2 + 13x
$$

### Step 2: Cost Function $C(x)$

The updated cost function is:

$$
C(x) = 1.25x + 26.50
$$

### Step 3: Find the Break-Even Points

The break-even points occur when the revenue equals the cost, i.e., when:

$$
R(x) = C(x)
$$

Substitute the functions for $R(x)$ and $C(x)$:

$$
-\frac{1}{5}x^2 + 13x = 1.25x + 26.50
$$

Simplify the equation:

$$
-\frac{1}{5}x^2 + 13x - 1.25x = 26.50
$$

$$
-\frac{1}{5}x^2 + 11.75x = 26.50
$$

Multiply the equation by $5$ to eliminate the fraction:

$$
-x^2 + 58.75x = 132.50
$$

Rearrange the equation:

$$
x^2 - 58.75x + 132.50 = 0
$$

Solve this quadratic equation using the quadratic formula:

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$

Where $a = 1$, $b = -58.75$, and $c = 132.50$.

The solutions (break-even points) are:

$$
x = \frac{58.75 \pm \sqrt{58.75^2 - 4(1)(132.50)}}{2}
$$

Calculate:

$$
x = \frac{58.75 \pm \sqrt{3452.56 - 530}}{2}
$$

$$
x = \frac{58.75 \pm \sqrt{2922.56}}{2}
$$

$$
x = \frac{58.75 \pm 54.06}{2}
$$

Thus, the break-even points are:

$$
x_1 = \frac{58.75 + 54.06}{2} = 56.41
$$

$$
x_2 = \frac{58.75 - 54.06}{2} = 2.35
$$

The break-even points occur when approximately 2.35 and 56.41 lattes are sold.
    
    
Now we can plug these $x$ values into the revenue and cost function separately and verify that they're equal.
    
### Step 1: Revenue Function
The revenue function is:

$$
R(x) = -\frac{1}{5}x^2 + 13x
$$

### Step 2: Cost Function
The cost function is:

$$
C(x) = 1.25x + 26.50
$$

### Plugging in $x = 2.35$

#### Revenue at $x = 2.35$

Substitute $x = 2.35$ into the revenue function:

$$
R(2.35) = -\frac{1}{5}(2.35)^2 + 13(2.35)
$$

First, calculate the square of 2.35:

$$
(2.35)^2 = 5.5225
$$

Now calculate the revenue:

$$
R(2.35) = -\frac{1}{5}(5.5225) + 13(2.35)
$$

$$
R(2.35) = -1.1045 + 30.55
$$

$$
R(2.35) \approx 29.45
$$

#### Cost at $x = 2.35$

Substitute $x = 2.35$ into the cost function:

$$
C(2.35) = 1.25(2.35) + 26.50
$$

First, calculate:

$$
1.25(2.35) = 2.9375
$$

Now calculate the cost:

$$
C(2.35) = 2.9375 + 26.50
$$

$$
C(2.35) = 29.4375
$$

### Plugging in $x = 56.41$

#### Revenue at $x = 56.41$

Substitute $x = 56.41$ into the revenue function:

$$
R(56.41) = -\frac{1}{5}(56.41)^2 + 13(56.41) \approx 96.91
$$

#### Cost at $x = 56.41$

Substitute $x = 56.41$ into the cost function:

$$
C(56.41) \approx 97.0125
$$

### Conclusion:

- At $x = 2.35$:
  - Revenue $R(2.35) \approx 29.45$
  - Cost $C(2.35) \approx 29.44$
  
- At $x = 56.41$:
  - Revenue $R(56.41) \approx 96.91$
  - Cost $C(56.41) \approx 97.01$

The values are very close, confirming that the revenue and cost are equal at these break-even points, with slight differences due to rounding in the calculations.


This agrees with the graph.

    
</details>

## e. Find the profit function $P(x)$ and its domain. Plot $P(x)$.

<details> <summary> Example: </summary>

### Step 1: Define the Profit Function

The profit function $P(x)$ is the difference between the revenue and cost functions:

$$
P(x) = R(x) - C(x)
$$

Where:
- $R(x)$ is the revenue function,
- $C(x)$ is the cost function.

### Step 2: Revenue Function

From the previous solution, the revenue function is:

$$
R(x) = -\frac{1}{5}x^2 + 13x
$$

### Step 3: Updated Cost Function

The updated cost function, as per the new information, is:

$$
C(x) = 1.25x + 26.50
$$

### Step 4: Write the Profit Function

Substitute the revenue function $R(x)$ and the cost function $C(x)$ into the profit function equation:

$$
P(x) = \left(-\frac{1}{5}x^2 + 13x\right) - \left(1.25x + 26.50\right)
$$

Simplify the expression:

$$
P(x) = -\frac{1}{5}x^2 + 13x - 1.25x - 26.50
$$

$$
P(x) = -\frac{1}{5}x^2 + 11.75x - 26.50
$$

### Step 5: Determine the Domain

The domain of the profit function is the same as the domain of the revenue function, which is based on the price-demand equation. The domain is:

$$
0 \leq x \leq 65
$$

### Final Answer:

The profit function is:

$$
P(x) = -\frac{1}{5}x^2 + 11.75x - 26.50
$$

The domain of the profit function is:

$$
0 \leq x \leq 65
$$

    
![image](https://hackmd.io/_uploads/SyXm4QjyJg.png)



</details>

## f. Find the price to maximize the profit. How many cups of latte are sold per day and what is the maximum daily profit?

<details> <summary> Example: </summary>

### Step 1: Profit Function

The profit function is given by:

$$
P(x) = -\frac{1}{5}x^2 + 11.75x - 26.50
$$

### Step 2: Find the Marginal Profit (Derivative of $P(x)$)

To find the value of $x$ that maximizes the profit, we first need to find the marginal profit, which is the derivative of the profit function $P(x)$. 

Differentiate $P(x)$:

$$
P'(x) = \frac{d}{dx} \left(-\frac{1}{5}x^2 + 11.75x - 26.50\right)
$$

The derivative is:

$$
P'(x) = -\frac{2}{5}x + 11.75
$$

### Step 3: Set the Marginal Profit Equal to Zero

To find the critical points, set $P'(x) = 0$:

$$
-\frac{2}{5}x + 11.75 = 0
$$

Solve for $x$:

$$
-\frac{2}{5}x = -11.75
$$

Multiply both sides by $-5/2$ to isolate $x$:

$$
x = \frac{11.75 \times 5}{2} = 29.375
$$

Thus, the value of $x$ that maximizes the profit is $x = 29.375$.

### Step 4: Verify Maximum with Sign Chart of $P'(x)$

To verify that $x = 29.375$ is a maximum, we will use a sign chart for $P'(x)$ around this critical point.

The derivative is:

$$
P'(x) = -\frac{2}{5}x + 11.75
$$

We will test values of $x$ on both sides of $x = 29.375$.

| Interval          | Test $x$ value | Work                                      | Sign of $P'(x)$  |
|-------------------|----------------|-------------------------------------------|------------------|
| $(-\infty, 29.375)$ | $x = 0$        | $P'(0) = -\frac{2}{5}(0) + 11.75 = 11.75$ | Positive         |
| $(29.375, \infty)$ | $x = 40$       | $P'(40) = -\frac{2}{5}(40) + 11.75 = -4.25$ | Negative         |

### Conclusion

- For $x < 29.375$, $P'(x)$ is positive, meaning $P(x)$ is increasing.
- For $x > 29.375$, $P'(x)$ is negative, meaning $P(x)$ is decreasing.

Since $P'(x)$ changes from positive to negative at $x = 29.375$, this confirms that $P(x)$ has a maximum at $x = 29.375$.


### Step 5: Calculate the Maximum Profit

Now that we know $x = 29.375$ maximizes the profit, we can substitute this value back into the profit function $P(x)$ to find the maximum profit.

Substitute $x = 29.375$ into $P(x)$:

$$
P(29.375) = -\frac{1}{5}(29.375)^2 + 11.75(29.375) - 26.50= 146.078125
$$

Thus, the maximum daily profit is approximately $146.08.

### Step 6: Price and Quantity of Lattes Sold

To find the price that maximizes profit, recall that the price-demand equation is:

$$
p = -\frac{1}{5}x + 13
$$

Substitute $x = 29.375$ into this equation:

$$
p = -\frac{1}{5}(29.375) + 13
$$

$$
p = -5.875 + 13
$$

$$
p = 7.125
$$

Thus, the price that maximizes profit is approximately $7.13, and the number of lattes sold per day to maximize profit is approximately 29.

### Final Answer:

- The price that maximizes profit is approximately $7.13.
- The number of lattes sold per day to maximize profit is approximately 29.
- The maximum daily profit is approximately $146.08.


</details>