We are given the differential equation:
\[
\frac{dy}{dx} - y = \cos x
\]
Step 1: Solve the homogeneous equation.
The homogeneous equation is:
\[
\frac{dy}{dx} - y = 0
\]
This is a first-order linear differential equation with the solution:
\[
y_h = ce^x
\]
Step 2: Find a particular solution.
To find a particular solution, we use the method of undetermined coefficients. We assume a solution of the form:
\[
y_p = A\sin x + B\cos x
\]
Substitute \( y_p \) into the original differential equation:
\[
\frac{d}{dx}(A\sin x + B\cos x) - (A\sin x + B\cos x) = \cos x
\]
\[
A\cos x - B\sin x - A\sin x - B\cos x = \cos x
\]
\[
- (A + B)\sin x + (A - B)\cos x = \cos x
\]
Equating the coefficients of \( \sin x \) and \( \cos x \):
\[
A + B = 0 \quad \text{and} \quad A - B = 1
\]
Solving these equations gives:
\[
A = \frac{1}{2}, \quad B = -\frac{1}{2}
\]
Thus, the particular solution is:
\[
y_p = \frac{1}{2}(\sin x - \cos x)
\]
Step 3: Write the general solution.
The general solution is the sum of the homogeneous and particular solutions:
\[
y = y_h + y_p = ce^x + \frac{\sin x - \cos x}{2}
\]
Step 4: Conclusion.
Therefore, the solution to the differential equation is:
\[
y = \frac{\sin x - \cos x}{2} + ce^x
\]
Thus, the correct answer is (A).