a)Gọi pt đường thẳng d là: \(y=ax+b\left(a\ne0\right)\)
Vì d có hệ số góc là k \(\Rightarrow a=k\)
Vì (d) đi qua điểm \(A\left(-2;-1\right)\Rightarrow-1=-2k+b\Rightarrow b=\dfrac{1}{2k}\)
\(\Rightarrow\left(d\right):y=kx+\dfrac{1}{2k}\)
b) Vì điểm \(B\in\left(P\right)\Rightarrow y_B=-2x_B^2=-2\Rightarrow B\left(1;-2\right)\)
\(\Rightarrow-2=k+\dfrac{1}{2k}\Leftrightarrow-2=\dfrac{2k^2+1}{2k}\Rightarrow-4k=2k^2+1\)
\(\Rightarrow2k^2+4k+1=0\)
\(\Delta=4^2-4.2=8\)
\(\Rightarrow\left[{}\begin{matrix}k=\dfrac{-b-\sqrt{\Delta}}{2a}=\dfrac{-4-\sqrt{8}}{4}=\dfrac{-2-\sqrt{2}}{2}\\k=\dfrac{-b+\sqrt{\Delta}}{2a}=\dfrac{-4+\sqrt{8}}{4}=\dfrac{-2+\sqrt{2}}{2}\end{matrix}\right.\)