Externalities - First order conditions I am currently reading the book "Microeconomics: Principles and Analysis" by Cowell on my own. I'm reading the externalities chapter, and i found an interesting example:

There are just two firms: firm 1 is a polluter and firm 2 the victim. Firm 2 (the victim) makes an offer of a side-payment or bribe to firm 1. The bribe is an amount that is made conditional upon the amount of output that firm 1 generates: the greater the pollution, the smaller is the bribe; so we model the bribe as a decreasing function β(⋅).

The optimization problem is



My question is how did they arrive at those FOC's? 

UPDATE:The second part of this optimization is to look at the problem from firm 1 perspective, it follows like this:
Now look at the problem from the point of view of firm 1. Once the victim
firm makes its offer of a conditional bribe, firm 1 should take account of it. So
its profits must look like this



This is from F.A.Cowell - Microeconomics - Principles and Analysis p.444-445
To make sure it's completely explicit: superscripts below are indices referring to either firm $1$ or firm $2$.

The choice variables in this problem are $\mathbf{q}^2$ and $\beta$. Notice that $\mathbf{q}^2$ is a vector of $n$ quantities. That is to say, $\mathbf{q}^2=\left(q_1^2,q_2^2,\ldots,q_n^2\right)$.

$(13.9)$ is just the derivative of the objective function $(13.8)$ with respect to $q_i^2$. Notice that you can rewrite the objective function $(13.8)$ as $$ p_1q_1^2+p_2q_2^2+\cdots+p_iq_i^2+\cdots+p_nq_n^2-\beta\left(q_1^1\right)-\mu_2\Phi^2\left(q_1^2,\ldots,q_i^2,\ldots,q_n^2 ,q_1^1\right) $$

Differentiating this with respect to $q_i^2$ and setting that equal to $0$ gives us $$ p_i - \mu_2 \frac{\partial\Phi^2 \left( \mathbf{q}^2,q_1^1 \right)}{\partial q_i^2}  = 0 $$

In Cowell's notation, $\Phi^2_i$ is just the derivative of $\Phi^2$ with respect to $q_i^2$.

The second first-order condition is the derivative of the objective function with respect to $\beta$. Since $\beta(\cdot)$ is a decreasing function of $q_1^1$, we can also think of $q_1^1$ as a decreasing function of $\beta$. (Formally, $q_1^1$ is the inverse of $\beta$, which is well-defined since $\beta$ is decreasing. Intuitively, if firm $2$ conditions their bribe on firm $1$'s level of output, then firm $1$'s output choice also depends on the amount of the bribe.)

Thus, applying the chain rule, the derivative of the objective with respect to $\beta$ is $$ -1 -\mu_2\frac{\partial\Phi^2 \left( \mathbf{q}^2,q_1^1 \right)}{\partial q_1^1} \frac{dq_1^1}{d\beta}=0 $$
which, unfortunately, isn't quite the same as in Cowell. Notice however that $\frac{dq_1^1}{d\beta}&lt;0$, so perhaps he is using the absolute value of that derivative to get rid of the minus sign in front of $\mu_2$.