Tangents and Secants – Circle Geometry

Tangents and Secants - Circle Geometry

Tangents and Secants - Circle Geometry

Explore properties of tangents and secants to circles

Results will appear here

`; return; } const tangentLength = Math.sqrt(distance * distance - radius * radius); document.getElementById('result').innerHTML = `

Tangent Length Calculation

Formula: PT = √(OP² - r²)

Calculation: PT = √(${distance}² - ${radius}²) = √(${distance*distance} - ${radius*radius})

Tangent Length: ${tangentLength.toFixed(2)} units

Theorem: The tangent to a circle is perpendicular to the radius at the point of contact

`; } function calculateSecant() { const radius = parseFloat(document.getElementById('radius').value); const distance = parseFloat(document.getElementById('distance').value); const secantLength = parseFloat(document.getElementById('secantLength').value); if (distance <= radius) { document.getElementById('result').innerHTML = `

Secant Segment Calculation

Error: The point must be outside the circle (distance > radius)

`; return; } // Using the secant-tangent theorem: PA × PB = PT² const tangentLength = Math.sqrt(distance * distance - radius * radius); const externalPart = (tangentLength * tangentLength) / secantLength; const internalPart = secantLength - externalPart; document.getElementById('result').innerHTML = `

Secant Segment Calculation

Formula: PA × PB = PT² (Secant-Tangent Theorem)

Given: PB = ${secantLength} units, PT = ${tangentLength.toFixed(2)} units

Calculation: PA = PT² / PB = ${(tangentLength*tangentLength).toFixed(2)} / ${secantLength}

External Segment (PA): ${externalPart.toFixed(2)} units

Internal Segment (AB): ${internalPart.toFixed(2)} units

`; } function drawCircle() { const canvas = document.getElementById('circleDiagram'); const ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); const radius = parseFloat(document.getElementById('radius').value); const distance = parseFloat(document.getElementById('distance').value); // Center of circle const centerX = 200; const centerY = 200; const scale = 20; // Pixels per unit // Draw circle ctx.strokeStyle = '#3498db'; ctx.lineWidth = 2; ctx.beginPath(); ctx.arc(centerX, centerY, radius * scale, 0, 2 * Math.PI); ctx.stroke(); // Draw center ctx.fillStyle = '#3498db'; ctx.beginPath(); ctx.arc(centerX, centerY, 4, 0, 2 * Math.PI); ctx.fill(); ctx.fillText('O', centerX - 10, centerY - 10); // Draw external point const pointX = centerX + distance * scale; const pointY = centerY; ctx.fillStyle = '#e74c3c'; ctx.beginPath(); ctx.arc(pointX, pointY, 4, 0, 2 * Math.PI); ctx.fill(); ctx.fillText('P', pointX + 10, pointY - 10); // Draw tangents if (distance > radius) { const tangentLength = Math.sqrt(distance * distance - radius * radius); const angle = Math.asin(radius / distance); // Calculate tangent points const tx1 = centerX + radius * scale * Math.cos(angle); const ty1 = centerY - radius * scale * Math.sin(angle); const tx2 = centerX + radius * scale * Math.cos(angle); const ty2 = centerY + radius * scale * Math.sin(angle); // Draw tangents ctx.strokeStyle = '#e74c3c'; ctx.setLineDash([]); ctx.beginPath(); ctx.moveTo(pointX, pointY); ctx.lineTo(tx1, ty1); ctx.moveTo(pointX, pointY); ctx.lineTo(tx2, ty2); ctx.stroke(); // Draw tangent points ctx.fillStyle = '#27ae60'; ctx.beginPath(); ctx.arc(tx1, ty1, 4, 0, 2 * Math.PI); ctx.arc(tx2, ty2, 4, 0, 2 * Math.PI); ctx.fill(); ctx.fillText('T₁', tx1 - 10, ty1 - 10); ctx.fillText('T₂', tx2 - 10, ty2 + 20); // Draw radii to tangent points ctx.strokeStyle = '#7f8c8d'; ctx.setLineDash([5, 5]); ctx.beginPath(); ctx.moveTo(centerX, centerY); ctx.lineTo(tx1, ty1); ctx.moveTo(centerX, centerY); ctx.lineTo(tx2, ty2); ctx.stroke(); // Add length labels ctx.fillStyle = '#000'; ctx.font = '12px Arial'; ctx.fillText(`r = ${radius}`, centerX - 20, centerY - radius * scale / 2); ctx.fillText(`OP = ${distance}`, centerX + distance * scale / 2, centerY + 15); ctx.fillText(`PT = ${tangentLength.toFixed(2)}`, pointX - 50, pointY - 30); } // Draw secant if provided const secantLength = parseFloat(document.getElementById('secantLength').value); if (secantLength > 0 && distance > radius) { const externalPart = (tangentLength * tangentLength) / secantLength; const internalPart = secantLength - externalPart; // Calculate secant endpoints const secantAngle = Math.acos((distance * distance + radius * radius - (internalPart * internalPart)) / (2 * distance * radius)); const sx1 = centerX + radius * scale * Math.cos(secantAngle); const sy1 = centerY - radius * scale * Math.sin(secantAngle); const sx2 = centerX + radius * scale * Math.cos(-secantAngle); const sy2 = centerY - radius * scale * Math.sin(-secantAngle); // Draw secant ctx.strokeStyle = '#9b59b6'; ctx.setLineDash([]); ctx.beginPath(); ctx.moveTo(pointX, pointY); ctx.lineTo(sx1, sy1); ctx.lineTo(sx2, sy2); ctx.stroke(); // Label secant segments ctx.fillStyle = '#9b59b6'; ctx.fillText(`PA = ${externalPart.toFixed(2)}`, (pointX + sx1) / 2, (pointY + sy1) / 2 - 10); ctx.fillText(`AB = ${internalPart.toFixed(2)}`, (sx1 + sx2) / 2, (sy1 + sy2) / 2 - 10); } } // Initial drawing drawCircle();

Author