The sagetex package gives you access to a computer algebra system, called SAGE, which can help. SAGE documentation for Symbolic equations is here and documentation for the package is here. Here is a sample of how you can combine SAGE with LaTeX through sagetex:
\documentclass{article}
\usepackage{sagetex}
\begin{document}
\begin{sagesilent}
a,b,c,d = var("a,b,c,d")
eqn = a/b==c/d
\end{sagesilent}
Given variables $a, b, c$, and $d$; then:\\
$(a+b)(c+d)=\sage{expand((a+b)*(c+d))}$ and \\
$(a+b+c)^2=\sage{expand((a+b+c)^2)}$. \\
Moreover, $\frac{a}{b}=\frac{c}{d}$ implies $\sage{(b*d)*eqn}$
\begin{sagesilent}
y=var("y")
f = x^2 + y^2 == 1
solutions = f.solve(x)
\end{sagesilent}
If you have the equation $x^2+y^2=1$ then solving for $x$ gives
$\sage{f.solve(x)[0]}$ and $\sage{f.solve(x)[1]}$
\end{document}
SAGE recognizes x as a default variable, everything else should be declared using var(). Set up the calculations in SAGE through sagesilent and access the results using \sage{}. SAGE is not part of the LaTeX distribution so it should be installed on your computer or accessed through a free Cocalc account. The result of the code being compiled is shown below:

It's easy to make a mistake typesetting math as you did in the first equation. SAGE helps eliminate mistakes.