This picture is from top252 ic of smps. Out of million questions, why is a capacitor[C6] is connected across transformer.
Yes, it's not all that clear but basically it's about reduction of EMI generated by the secondary winding.
Normally, for a 3-pin AC or DC input, this capacitor would connect from the secondary to the earth pin.
The secondary is of course floating but, due to the construction of the transformer, capacitively connects to the primary winding. That primary winding has a clean side (the DC rail) and a dirty side (the side that is switched on and off by the MOSFET in U1). So there is a large, AC, high frequency voltage capacitively coupled to the secondary that raises and lowers the whole of the secondary circuit at high speed.
This will generate EMI on the output wires and the device would fail emission testing. The added capacitor seeks to significantly reduce this effect by shunting this capacitively coupled voltage back to a fairly clean point in the circuit. There is no earth point so the positive supply voltage is used but equally, the negative supply voltage line would also work.
In short C6 provides a return path for the high frequency signals that are generated by the switching on the primary side of the transformer. Part of these signals are coupled through the transformer to the secondary (low voltage) side of the transformer.
We all know currents travel in loops and without C6 there is no way that these signals can travel back to the primary side of the transformer. That would result in the signals having no choice but to travel through the output of the supply and causing EMI problems.
C6 provides a path for these signals to travel back to the primary side of the transformer. This keeps the loop short and prevents EMI emissions.
C6 has to by a Y-class capacitor for safety reasons. It needs to be able to withstand high voltages and also if it fails it is not allowed to fail and make a short as this will put mains voltage at the output of the supply !