Online Algebra Equation Solver

Online Algebra Equation Solver 📝

Enter a linear or quadratic equation with a single variable (e.g., 'x') to see its solution and step-by-step derivation.

Step 1: Provide Your Equation

Step 2: Solution and Derivation

Please enter an equation and click "Solve Equation" to see the results here.

${solution || "Not found or not applicable."}

`; outputHTML += `

Step-by-step Derivation:

    `; steps.forEach(step => outputHTML += `
  • ${step}
  • `); outputHTML += `
`; oaes_resultsOutputEl.innerHTML = outputHTML; // Switch to solution tab if(oaes_solutionTabButtonEl) oaes_solutionTabButtonEl.click(); } function oaes_downloadPdf() { const { jsPDF } = window.jspdf; if (typeof jsPDF === 'undefined' || typeof html2canvas === 'undefined') { alert('Error: PDF generation libraries (jsPDF or html2canvas) are not loaded.'); return; } const resultsContent = document.getElementById('oaes-resultsOutput'); if (!resultsContent || resultsContent.textContent.trim().startsWith("Please enter an equation")) { alert("Please solve an equation first before downloading the PDF."); return; } const toolContainer = document.getElementById('oaes-tool-container'); // Temporarily remove main tool container border/shadow for cleaner PDF of just the results const originalStyles = { border: toolContainer.style.border, boxShadow: toolContainer.style.boxShadow, }; toolContainer.style.border = 'none'; toolContainer.style.boxShadow = 'none'; const pdfHeader = `Algebra Equation Solver - Solution`; html2canvas(resultsContent, { scale: 2, backgroundColor: '#ffffff', useCORS: true }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 40; const contentWidth = pdfWidth - 2 * margin; pdf.setFontSize(18); pdf.setTextColor(parseInt(getComputedStyle(document.documentElement).getPropertyValue('--primary-color').substring(1,3),16), parseInt(getComputedStyle(document.documentElement).getPropertyValue('--primary-color').substring(3,5),16), parseInt(getComputedStyle(document.documentElement).getPropertyValue('--primary-color').substring(5,7),16)); pdf.text(pdfHeader, margin, margin); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * contentWidth) / imgProps.width; let currentY = margin + 30; if (currentY + imgHeight > pdfHeight - margin) { // Check if content fits pdf.addPage(); currentY = margin; // Reset Y for new page } pdf.addImage(imgData, 'PNG', margin, currentY, contentWidth, imgHeight); // Restore original styles toolContainer.style.border = originalStyles.border; toolContainer.style.boxShadow = originalStyles.boxShadow; pdf.save('Algebra-Equation-Solution.pdf'); }).catch(err => { console.error("Error generating PDF: ", err); alert("An error occurred while generating the PDF. Please check the console."); toolContainer.style.border = originalStyles.border; toolContainer.style.boxShadow = originalStyles.boxShadow; }); }
Scroll to Top