\(I=\int e^xcosxdx\Rightarrow\left\{{}\begin{matrix}u=cosx\\dv=e^xdx\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}du=-sinx.dx\\v=e^x\end{matrix}\right.\)
\(\Rightarrow I=e^xcosx+\int e^xsinx.dx=e^xcosx+I_1\)
\(I_1=\int e^xsinx\Rightarrow\left\{{}\begin{matrix}u=sinx\\dv=e^xdx\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}du=cosx.dx\\v=e^x\end{matrix}\right.\)
\(\Rightarrow I_1=e^xsinx-\int e^xcosx.dx=e^x.sinx-I\)
\(\Rightarrow I=e^xcosx+e^xsinx-I\Rightarrow2I=e^x\left(cosx+sinx\right)\)
\(\Rightarrow I=e^x\left(\frac{1}{2}cosx+\frac{1}{2}sinx\right)+C\Rightarrow\left\{{}\begin{matrix}A=\frac{1}{2}\\B=\frac{1}{2}\end{matrix}\right.\)
\(\Rightarrow A+B=1\)