What is the correct way to add a direct voltage and an alternating voltage?
Added to that, the both the AC and DC signals are going through voltage divider, but that isn't important.
It turns out, from your additional information in the comments, that it is important:
Basically, I want to measure the Mains voltage (230V/50Hz) using an ADC channel from a microcontroller.
I think your question is really, "How can I (safely) add a half \$ V_{REF} \$ offset to a signal potentially divided from the mains voltage?"
What you seem to be proposing is
simulate this circuit – Schematic created using CircuitLab
Figure 1. OP's proposal. Note that there is no mains isolation.
If you are proposing the circuit of Figure 1 then I suggest that you redesign. There is no isolation between the mains and micro. At best you will have neutral voltage appear on your micro ground. Do not assume that this will be zero as any current flowing from other circuits through the neutral wiring back to the mains source will cause a voltage drop along the resistance of the cable.) A far more serious situation will arise if the live and neutral connections were swapped. In this case the micro GND will become live.
Also, since you seem to be in 50 Hz land it is likely that your mains voltage will be 220 to 240 V. In this case a single resistor may not have adequate voltage rating for the high voltage supply. Two series resistors would be required for the high-side resistor.
Figure 2. A small mains transformer of a few VA will provide isolation, a signal to work with and an easy means of adding a DC bias to the AC signal.
- A 6 or 9 V transformer would be adequate for this circuit and provide a safe working voltage with no isolation or safety issues.
- Size R1 and R2 to pull a few tens of mA from the transformer and reduce the peak voltage to the operating limits of the micro.