(* Profits in the highest price range C *) 
(* Solution to first-order condition, and second-order condition *)
profits3 =(pM-c)2(Sqrt[(s-pM)/t]);
FullSimplify[Solve[D[profits3,pM]==0,pM]]
FullSimplify[D[profits3,{pM,3}]]

(* Optimal profits in the highest price range C *) profits3 =FullSimplify[((1/3) (c+2 s)-c)2(Sqrt[(s-(1/3) (c+2 s))/t])]

(* Optimal profits in price range B2 *)
pMbindingconstr=s-((λM)^2)t;
profits2bindingconstr=FullSimplify[(pMbindingconstr-c)(λM+(Sqrt[(s-pMbindingconstr)/t]))]

(* Profits in price range B1 *)
(* Two solutions to first-order condition, and second-order condition *)profits2 =(pM-c)(λM+(Sqrt[(s-pM)/t]));
FullSimplify[Solve[D[profits2,pM]==0,pM]]
FullSimplify[D[profits2,{pM,2}]]

(* Positive root might result in lower profits in price range B1, or not *)profits2negroot=FullSimplify[((1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))-c)(λM+(Sqrt[(s-(1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))]))))/t]))]
profits2posroot=FullSimplify[((1/9) (3 c+6 s-2 t ((λM)^2)+2 (Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))]))-c)(λM+(Sqrt[(s-(1/9) (3 c+6 s-2 t ((λM)^2)+2 (Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))/t]))];
FullSimplify[profits2posroot/profits2negroot]

(* Profits strictly positive for s above minimum level *)
FullSimplify[Solve[-(2/27) (3 c-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])) ==0,s]]
FullSimplify[-(2/27) (3 c-3 (c+5t ((λM)^2))+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 (c+5t ((λM)^2))+t ((λM)^2))])) ]

(* Find s so that price for B2 equals price for B1 *)
(* Note that s->c+t ((λM)^2) is ruled out because it would be below s->c+3t ((λM)^2), the threshold for the upper price range C *)FullSimplify[Solve[(1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))==s-((λM)^2)t,s]]

(* Find s so that profit for B2 equal profit for B1 *)

FullSimplify[Solve[((1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))-c)(λM+(Sqrt[(s-(1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))]))))/t]))==-(c-s+t ((λM)^2)) 2λM,s]]

(* Find s so that price for B1 equals price for A *)FullSimplify[Solve[(1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))==s-(((1-λM))^2)t,s]]

(* To find correct root, note that the first-order condition for interior price in B (B1) must be strictly positive when evaluated at price A *)
FullSimplify[D[profits2,pM]]
FullSimplify[Solve[(Sqrt[((-s+(((1-λM))^2)t+s)/t)])+((c-s+(((1-λM))^2)t)/(2 (Sqrt[((-s+(((1-λM))^2)t+s)/t)]) t))+λM==0,s]]
FullSimplify[c+3 t (((-1+λM))^2)+2 t (1-λM) λM]

(* Compare boundaries, difference strictly positive for λM<.5 *)
FullSimplify[c+t (-3+λM) (-1+λM)-c+5 t ((λM)^2)]

(* Evaulate profits for range A at boundary *)
profits1 =(pM-c);
profits1 =(s-(((1-λM))^2)t-c);
FullSimplify[profits1 =((c+t (-3+λM) (-1+λM))-(((1-λM))^2)t-c)]

(* Evalute profit B1 at upper s boundary for negative root *)(* FullSimplify[Solve[((1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))])))-c)(λM+(Sqrt[(s-(1/9) (3 c-2 (-3 s+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 s+t ((λM)^2))]))))/t]))==(s-(((1-λM))^2)t-c),s]] *)
FullSimplify[-(2/27) (3 c-3 (c+t (-3+λM) (-1+λM))+t ((λM)^2)+(Sqrt[t ((λM)^2) (-3 c+3 (c+t (-3+λM) (-1+λM))+t ((λM)^2))])) (3 λM+√(1/t(-3 c+3 (c+t (-3+λM) (-1+λM))+2 t ((λM)^2)+2 (Sqrt[t ((λM)^2) (-3 c+3 (c+t (-3+λM) (-1+λM))+t ((λM)^2))]))))]
FullSimplify[-(2/27) (t (3-2 λM) λM+t (-9-2 (-6+λM) λM)) (3 λM+(Sqrt[9+((2 t (3-2 λM) λM)/t)+λM (-12+5 λM)]))]
FullSimplify[(2/27) t (-3+λM) ((3-λM)+3 λM) (-3+4 λM)]
FullSimplify[Solve[(2/27) (-3+λM) (3+2 λM) (-3+4 λM)==2(1-λM),λM]]
Plot[(2/27) (-3+λM) (3+2 λM) (-3+4 λM)-2(1-λM),{λM,0,.5}]

(* Change in optimal profits B2 with λM *)
FullSimplify[D[profits2bindingconstr,λM]]
FullSimplify[(((2λM) (-c+s+3 t λM (-2 λM+λM)))/(λM))]

(* Change in optimal profits B1 with λM *)
Simplify[D[profits2negroot,λM]]
Solve[D[profits2negroot,λM]==0,λM]
-2 λM(Sqrt[-3 c/t+3 s/t+((λM)^2)])+3 c/t-3 s/t-2 ((λM)^2)
+3 s/t-3 c/t- ((λM)^2)- λM(Sqrt[(-3 c/t+3 s/t+((λM)^2))])

(* Plot optimal profit in B1 and its derivatives in relevant σ and λ ranges for B1 *)
Plot3D[Max[(2/27)(3σ-(λ^2)-λ(Sqrt[3σ+(λ^2)]))(3λ+(Sqrt[3σ+2(λ^2)+2λ(Sqrt[3σ+(λ^2)])])),0],{λ,0,.5},{σ,5(λ^2),(1-λ)(3-λ)},AxesLabel->Automatic]
Solve[3σ-(λ^2)-λ(Sqrt[3σ+(λ^2)])==0,λ]
FullSimplify[D[(2/27)(3σ-(λ^2)-λ(Sqrt[3σ+(λ^2)]))(3λ+(Sqrt[3σ+2(λ^2)+2λ(Sqrt[3σ+(λ^2)])])),λ]];
Plot3D[%,{λ,0,.5},{σ,5(λ^2),(1-λ)(3-λ)},AxesLabel->Automatic]
FullSimplify[D[(2/27)(3σ-(λ^2)-λ(Sqrt[3σ+(λ^2)]))(3λ+(Sqrt[3σ+2(λ^2)+2λ(Sqrt[3σ+(λ^2)])])),σ]]
Plot3D[%,{λ,0,.5},{σ,5(λ^2),(1-λ)(3-λ)},AxesLabel->Automatic]

(* Change in optimal profits B2 with λM *)
FullSimplify[D[(s-(((1-λM))^2)t-c),λM]]