# Quantum Synchronization and Entanglement of Dissipative Qubits Coupled to a Resonator
## Appendix A Semiclassical Theory for a Cavity Coupled to Several Qubits  
We start by reminding readers about the RWA Hamiltonian of a qubit coupled with two cavities:  
\[\hat{H}=\omega_{r}\hat{a}^{+}\hat{a}+F(\hat{a}+\hat{a}^{+})+\lambda_{1}(\hat{a} \hat{\sigma}_{1}^{+}+\hat{a}^{+}\hat{\sigma}_{1}^{-})+\frac{\Omega_{r1}}{2} \partial_{1z}+\lambda_{2}(\hat{a}\hat{\sigma}_{2}^{+}+\hat{a}^{+}\hat{\sigma}_ {2}^{-})+\frac{\Omega_{r2}}{2}\partial_{2z} \tag{11}\]  
where \(\omega_{r}=\omega_{0}-\omega\) and \(\Omega_{r1}=\Omega_{1}-\omega,\Omega_{r2}=\Omega_{2}-\omega\). We analytically compute and then minimize the following:  
\[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]  
over trial density matrices, which are given by the semiclassical ansatz:  
\[\hat{\rho}=\frac{1}{4}|\alpha\rangle\langle\alpha|\big{(}1+\rho_{1x}\hat{ \sigma}_{1x}+\rho_{1y}\hat{\sigma}_{1y}+\rho_{z}\hat{\sigma}_{1z}\big{)}\big{(} 1+\rho_{2x}\hat{\sigma}_{2x}+\rho_{2y}\hat{\sigma}_{2y}+\rho_{z}\hat{\sigma}_ {2z}\big{)} \tag{13}\]  
For the Hamiltonian part of the functional, we find the following:\[u_{1} =(1+\rho_{1x}^{2}+\rho_{1y}^{2}+\rho_{1z}^{2})/2 \tag{24}\] \[u_{2} =(1+\rho_{2x}^{2}+\rho_{2y}^{2}+\rho_{2z}^{2})/2\] (25) \[S_{0\mathcal{H}} =2(F^{2}+2 Fa_{x}\omega_{r}+(a_{x}^{2}+a_{y}^{2})\omega_{r}^{2}\] (26) \[S_{\lambda\mathcal{H}}(\rho_{x},\rho_{y},\rho_{z},\Omega_{r}) =2\lambda\big{[}F\rho_{x}+(\alpha_{x}\rho_{x}-\alpha_{y}\rho_{y})( \omega_{r}-\rho_{z}\Omega_{r})\big{]}\] \[+\frac{\lambda^{2}}{2}\Big{[}4\rho_{z}^{2}\Big{(}a_{x}^{2}+a_{y}^ {2}\Big{)}+\Big{(}4a_{x}^{2}+1\Big{)}\rho_{y}^{2}+8a_{x}\alpha_{y}\rho_{x}\rho _{y}+\Big{(}4a_{y}^{2}+1\Big{)}\rho_{x}^{2}+(\rho_{z}+1)^{2}\Big{]}\] (27) \[S_{2\mathcal{H}} =S_{0\mathcal{H}}u_{1}u_{2}+\frac{\Omega_{r1}^{2}(\rho_{1x}^{2}+ \rho_{1y}^{2})}{2}u_{2}+\frac{\Omega_{r2}^{2}(\rho_{2x}^{2}+\rho_{2y}^{2})}{2 }u_{1}\] \[+u_{2}S_{\lambda_{1}\mathcal{H}}(\rho_{1x},\rho_{1y},\rho_{1z}, \Omega_{r1})+u_{1}S_{\lambda_{2}\mathcal{H}}(\rho_{2x},\rho_{2y},\rho_{2z}, \Omega_{r2})+\lambda_{1}\lambda_{2}(\rho_{1x}\rho_{2x}+\rho_{1y}\rho_{2y}) \tag{28}\]  
To write the full functional, we need to introduce the following:  
\[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]0 \[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]1 (30) \[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]2  
The full semiclassical functional of a cavity coupled to two qubits is then given by the following:  
\[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]3 \[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]4 \[S_{2}=\text{Tr}\;[\mathcal{L}(\hat{\rho})]^{+}\mathcal{L}(\rho) \tag{12}\]5  
The functional is then minimized over cavity parameters, \(\alpha_{x},\alpha_{y}\), and spin projections, \(\rho_{1x},\rho_{1y},\rho_{1z},\rho_{2x},\rho_{2y},\rho_{2z}\), using the NLopt optimization library. The generalization of this functional to more qubits is a direct generalization of the two-qubit functional, keeping track of all the terms that are generated by the possible qubit combinations; for example, the term \(S_{0}u_{1}u_{2}\) becomes \(S_{0}u_{1}u_{2}u_{3}u_{4}\) for four qubits, \(\lambda_{1}\lambda_{2}(\rho_{1x}\rho_{2x}+\rho_{1y}\rho_{2y})\) becomes \(\lambda_{1}\lambda_{2}u_{3}u_{4}(\rho_{1x}\rho_{2x}+\rho_{1y}\rho_{2y})\), and so forth (the variables \(u_{3,4}\) are defined in analogy with Equations (24) and (25).